FAQ Database Discussion Community


How to get the file path from a device acting as a usb mass storage in android

android,usb,filepath,usb-otg
I am trying to get filenames(and also the filepath), from a Garmin device which acts as a usb mass storage. Connecting the device to the computer, the filepath is G:\Garmin. Connecting that to the android tablet using OTG and Explorer(i have check the app setting - the package name is...

What does slash dot refer to in a file path?

windows,git,gruntjs,filepath,slash
I'm trying to install a grunt template on my computer but I'm having issues. I realized that perhaps something different is happening because of the path given by the Grunt docs, which is %USERPROFILE%\.grunt-init\ What does that . mean before grunt-init? I've tried to do the whole import manually but...

Pythonic way of setting path from list

python,filepath,os.path
I've been trying to make a program for my brother. One of the components of this would be to play an audio file. I have a list of about 90 audio files (please don't ask me why I have 90), and I am trying to randomly selected one and play...

How do I get the Path to the latest created file in a folder with apple script?

applescript,filepath
I want to get the path to the last file created in folder test set p to "/Users/palmglow/Documents/googledrive/orders/IFTTT/test" set a to POSIX file "/Users/palmglow/Documents/googledrive/orders/IFTTT/test/" set latestFile to last item of (sort (get files of (POSIX file "/Users/palmglow/Documents/googledrive/orders/IFTTT/test")) by creation date) as alias ...

open image with FLTK on windows

c++,jpeg,filepath,fltk
I'm having problem: I was trying to add image to my _fl_group_ but was not able to do so. I was trying to identify where the problem occurs and according to specification on fltk's webpage, if image is opened with fl_JPEG_image(const char* path) constructor correctly, calling im->w() should return >...

Creating a file path to a file, where the files name changes daily

c#,filepath
I am trying to get a file path to a file where the file name keep changing. So far, I have a file path to a particular log file named 18052015.log. I am specifying the file name and extension, 18052015.log. string strFilePath = @"\\server-1\public\logs\18052015.log"; The file name matches a date....

How can i build to a folder that lives one directory down from my current folder

java,cmd,javac,filepath,shortcut
I want to compile to a file that lives in folder src. The build folder lives in the same folder as my src folder. So in CMD i am currently in C:\Programming Projects\Java Sample Projects\src> I want to build to C:\Programming Projects\Java Sample Projects\build> I know i can use the...

Python: too many joins()?

python,join,filepath
I'm not sure why I'm getting this error, I'm using str.join() and os.path.join() at different points in the script, is that the cause? Using os.path.join: from os.path import getsize, dirname, join class Wav: src_path = "No path" dest_path = destination old_name = "name.wav" new_name = "" def __init__(self, path): self.src_path...

java printwriter: Output file empty

java,filepath,printwriter
Question: How do you ask the defined output class to print result in the output file as .txt All other java classes seem to be working and runs alright but it fails to print out any data in the output folder. I have imported the PrintWriter, but it will not...

recursively grep through a directory, and extract the contents between the tags

recursion,grep,filepath,line-numbers
How may we recursively grep through a directory, and extract the contents specified below where the lines between the tags are located, i.e. line numbers and file location? ... < start > contents to be extracted this line as well and this line and before the tag < / start...

Getting the path of the running applications

c#,winforms,filepath
Good day! I really need your help. I am trying to get the path of the running applications that the program detects but whenever I click a particular name of a running app, it will only returns the path of the project (the windows application project that I am coding...

How to use ant unjar file from a jar into a specific directory without path from jar

ant,filepath,unzip,unjar
I want to copy files from within a jar to a specific directory without preserving the path in the jar. I can use unjar to find just the files I want from the jar OK: <unjar dest="some_dest_path" overwrite="true" src="somejar.jar"> <patternset> <include name="somepath_in_jar/somefile.ext" /> </patternset> </unjar> but the somefile gets extracted...

Only writing the relative filename from the full file name c#

c#,filepath
So I do not know if this is possible, but below I have a file path in a variable path: string path = @"c:\users\povermyer\documents\visual studio 2013\Projects\DanProject\PNRS \PNRS.log"; What I want to do is I want to have the console window write just the last part in the path. For example,...

How to filter file paths then use the resulting paths

file,file-io,rust,filepath
I trying to get a list of mp3 from a directory. let dir_paths = fs::read_dir(&Path::new("some_directory")).unwrap(); let paths = dir_paths.filter(|x| match x.unwrap().path().extension() { None => true, Some(ext) => ext == "mp3" }); The Error Message src/main.rs:27:48: 27:49 error: cannot move out of borrowed content src/main.rs:27 let paths = dir_paths.filter(|ref x| match...

Simple way to choose a file

java,filepath,joptionpane,jfilechooser
Is there some simple way to choose a file path in Java? I've been searching around, and JFileChooser keeps coming up, but that's already too excessive for what I want now, as it seems to require making a whole GUI just for that. I'll do it if need be, but...

PDF file path is incorrect [duplicate]

java,android,pdf,android-studio,filepath
This question already has an answer here: Android - Access file from assets \ PDF display 4 answers I want to open a PDF file in my application but something goes wrong everytime. Yeah , I watched many topics about it, however none of them helped me. Here are...

how to get Full Path if image to send to server by MultiPart in Android

android,image,filepath
In My App, user can take Picture from Camera Or Select from Gallery And Crop It to send to server. So there is No Problem., Problem is when user select picture from Gallery URI path from camera cropped : /mnt/sdcard/avatar_1434958340804.jpg URI path from Storage cropped : /external/images/media/19 Error: IOException :...

Python genfromtxt file path

python,numpy,filepath,genfromtxt
I have an extremely basic problem with the numpy.genfromtxt function. I'm using the Enthought Canopy package: where shall I save the file.txt I want to use, or how shall I tell Python where to look for it? When using IDLE I simply save the file in a preset folder such...

space containing items in bash for-loop

bash,for-loop,whitespace,filenames,filepath
I want to recursively convert all markdown files under ./src/ to html: #!/bin/bash function do_recursive_pandoc { local markdown_src_file_extension=\*.markdown local markdown_src_path="$1" local html_output_path="$2" mkdir "$html_output_path" 2>/dev/null for i in $(find $markdown_src_path -name $markdown_src_file_extension 2>/dev/null | cut --delimiter='/' --fields=2- ) do mkdir "$html_output_path"/$(dirname "$i") 2>/dev/null pandoc -rmarkdown -whtml "$markdown_src_path"/"$i" --output="$html_output_path"/"$i".html done }...

Recursively expand and search pattern of specific subdirectories

python,path,filepath,subdirectories,wildcard-expansion
I'm looking for an option to search specific subdirectories in python. For instance a directory structure like this: some_files/ common/ 2009/ 2010/ 2011/ ... I only want to search for in the subdirectories that start with a 2, so that it must be something like 'some_files/2*'. I think it must...

Accessing a file path saved in a .txt file. (Python)

python,numpy,text,filepath
I have a text file that contains file paths of files that I wish to open. The text file looks like this: 28.2 -1.0 46 14 10 .\temp_109.17621\voltage_28.200\power_-1.txt 28.2 -2.0 46 16 10 .\temp_109.17621\voltage_28.200\power_-2.txt ... I would like to open the files at this filepath. First step is to load...

How to prevent MSYS to convert the file path for an external program

mingw,filepath,mingw-w64
I'm porting a Linux script to Windows & MinGW, which accesses the Android phone through ADB. Sometime I need to pass the Android's file path as ADB command line option. However, when invoking the ADB.exe, MinGW translates it to Windows' path. For example, adb shell cat /proc/version Is translated as...

Referencing file from realpath PHP

php,ftp,relative-path,filepath,realpath
I have a class that handles FTP stuff located here: /var/www/html/crm/rhinos/classes/ftp.php This class is included in a script that generates a spreadsheet here: /var/www/html/crm/send_cust_lock.php The generated spreadsheet is located here: /var/www/html/crm/tmp/cust_lock_1430424215.xlsx My class contains the following method: public function put($filepath){ $fp = fopen($filepath, 'r'); $z = ftp_fput($this->connection, $filepath, $fp, FTP_BINARY);...

OCaml - Accessing absolute paths

ocaml,filepath,qtquick2
I'm developing an application where I implement the GUI in QtQuick and the logic in OCaml, using lablqt. In QtQuick I use a FileDialog to select a file. I need to use the path that the FileDialog returns in my OCaml program but I get an error every time I...

Copyfile in matlab from one directory to another

matlab,filepath,file-management,copyfile
I have a short question regarding the copyfile function within MATLAB. Basically I want to copy a file from a different user selected directory/file to the current directory (where the function is run from). I am struggling with how to do this. So far I have: [jxlfilename,jxlfilepath] = uigetfile({'*.jxl'}, 'Pick...

Getting application folder path on MeteorJS?

javascript,web-applications,meteor,filepath
In Meteor I've been looking for a way to get the home folder of the running Meteor application in Server. For example, if my .meteor folder is in C:/Users/Me/Repos/MyWebsite/.meteor, is there a way to get the path C:/Users/Me/Repos/MyWebsite/, or where ever the app is currently running at? The reason I...

Manipulating temporary file paths

r,filenames,filepath,tempdir
I have a list of files on different temporary paths in tempdir(). The paths are given here, where /tmp/Rtmp9pF0OF is my tempdir() for my R session. [1] "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/0" "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/1" [3] "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/2" "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/3" [5] "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/4" "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/5" [7] "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/6" "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/7" [9]...

Reading a large number of files without hardcoding their path

java,text,filepath
This may be more of a "best practices" kind of question, but I am attempting to use two text documents in my current project and am unsure of the best way to proceed in reading and/or storing them. I currently have paths to them hard coded into my filereader, which...

Azure Web Role wont start when child folder has files with long paths

git,azure,asp.net-web-api,filepath
A bit of very remote help and a bit of a lingering question. For the last few days I have struggled with a very frustrating Azure Web Role issue. Essentially my workflow is as follows: Create a brand new Azure Cloud Service project Add a C# ASP.NET Web Role (Web...

FilePaths in Go

go,filepath
So this is the example from Programming in Go by Mark Summerfield. package main import ( "fmt" "io/ioutil" "os" "path/filepath" "strings" ) var britishAmerican = "british-american.txt" func init() { dir, _ := filepath.Split(os.Args[0]) britishAmerican = filepath.Join(dir, britishAmerican) } func main() { rawBytes, err := ioutil.ReadFile(britishAmerican) if err != nil {...

How to move folder from one location to another location using java

java,file,filesystems,filepath
How to move one folder from one location to another location ? Here is sample code what i did but here it is showing java.nio.file.NoSuchFileException I am using this Package: import java.nio.file.Files; import java.nio.file.StandardCopyOption; Path path1 = FileSystems.getDefault().getPath("D:\\VFSImagecomp\\compressed\\"); Path path2 = FileSystems.getDefault().getPath("D:\\destinitionFile\\"); Files.move(path1, path2, StandardCopyOption.REPLACE_EXISTING); Here i am trying to...

How to have ImageIO.write create a folder path as needed

java,file,filepath,javax.imageio
I have the following code: String nameAndPath = "C:\\example\\folder\\filename.png"; BufferedImage image = addInfoToScreenshot(); //this method works fine and returns a BufferedImage ImageIO.write(image, "png", new File(nameAndPath)); Now, the path C:\example\folder\ does NOT exist, so I get an exception thrown with message: (The system cannot find the path specified) How can I...

XSLT filePath with document as variable

variables,xslt,filepath
I try to use a variable in the filePath, but it isn't working: BodyPart filePath="C:\\FileOutEmail\\($vpDocNr).xml" content-type="" content-id="" content-disposition="" multipart-type="" I also tried with the whole path in a variable without results: BodyPart filePath='$bestand' content-type="" content-id="" content-disposition="" multipart-type="" Is this possible, what is the right syntax?...

regex for preg_replace: seperate path and filename

php,regex,preg-replace,filenames,filepath
In PHP I try to achieve to change a string: <img class="alignnone size-medium wp-image-18" src="http://localhost/wp-content/uploads/2015/02/300x149-jquerymobile.jpg" alt="jquerymobile" width="300" height="149"> to this: <img class="alignnone size-medium wp-image-18" src="" data-path="http://localhost/wp-content/uploads/2015/02/" data-img="300x149-jquerymobile.jpg" alt="jquerymobile" width="300" height="149"> I want wanna use preg_replace('/src="(what-is-a-path-regex)(.*)"/', 'src="" data-path="$1" data-img="$2"',...

Saving a file in a different place for linux

c++,char,filepath
I am trying to save a file somewhere else than the folder of the exe. I have pieced together this unelegant way: #include <stdio.h> #include <iostream> #include <fstream> #include <string> #include <unistd.h> using namespace std; int main() { //getting current path of the executable char executable_path[256]; getcwd(executable_path, 255); //unelegant back...

Data not being written to file?

ios,data,filepath,nsdocumentdirectory
I'm using FastttCamera as a wrapper on AVFoundation in order to implement a camera in my app. Things appear to work fine until I try to save a captured image with the following code: - (void)cameraController:(FastttCamera *)cameraController didFinishScalingCapturedImage:(FastttCapturedImage *)capturedImage { //Use the image's data that is received pngData = UIImagePNGRepresentation(capturedImage.scaledImage);...

Plugins cannot find their css styles in folder

javascript,css,plugins,filepath,file-not-found
I've downloaded this template: http://themeforest.net/item/-medic-medical-health-and-hospital-html5-theme/8331329 from themeforest. Original template has /plugins/ folder in root folder. I moved this folder into /assets/plugins/ and included it in HTML like this example: <script type="text/javascript" src="/assets/plugins/smooth-scroll.js"></script> The javascript files are found, but plugins are still requesting their css files from original folder /plugins and...

How do I conclude the right directory path when including in CSS/JS/HTML?

javascript,html,css,linker,filepath
considering these directories: /index.html /static/js/x.js /static/css/style.css /static/dist/some_framework_files... /static/img/x.jpg /static/fnt/sans_gio.css In index.html I want to <link> /static/css/style.css and <script src=""> /static/js/x.js In style.css I want to url() /static/img/x.jpg and @import /static/fnt/sans_gio.css And some other different cases... Now I want to know how I should write these files paths in general, how...

Convert Directory Path to JSON Directory Tree Representation

c#,json,tree,filepath
I have a sample output of the file paths, this is just an example the for the question New Text Document.txt New folder/ New folder/README.txt which I would like to convert to the following JSON { "Data":"/", "Nodes":[ { "Data":"New Folder", "Nodes":[ { "Data":"New Text Document.txt" } ] }, {...

Saved photos don't appear on device after update

ios,iphone,ipad,filepath
On my iPhone app, I'm saving pictures associated with an event via this code: [pngData writeToFile:filePath atomically:YES]; //Write the file self.thisTransaction.picPath = filePath; Later I retrieve and display the photo with this code: UIImage * image = [UIImage imageWithContentsOfFile:thisTransaction.picPath]; Works great on my iPad (I don't have an iPhone). However,...

Datapusher issue (409 Client error) during CKAN setup : maybe a filepath issue?

install,filepath,ckan
I'm writting here about a CKAN installation problem. I have already a functional datastore (I've got answer from the API test) and functional filestore, my config file is OK (all options sets, like site.url , etc...). I can post files on the CKAN site, I can get it, SOLR is...

Converting a File:///… string to an Absolute URI

java,android,uri,filepath,absolute-path
So I am making an app that lets users pick images from their gallery to display, as well as take photos from the camera. The image is previewed via a bitmap that takes the string of the file path. When the user takes a photo the code below handles it...