path

Directory.GetFiles returning entire path, I only want the filename?

This is the code I have set up to scan a directory of files: Dim fileArray() As String fileArray = Directory.GetFiles(System.AppDomain.CurrentDomain.BaseDirectory & "help\") And it successfully gets all files in the directory, but it gets their absolute paths aswell. For example, one of the entries in fileArray() is: F:\Project\Proje...

How can I remove relative path components but leave symlinks alone in Perl?

I need to get Perl to remove relative path components from a Linux path. I've found a couple of functions that almost do what I want, but: File::Spec->rel2abs does too little. It does not resolve ".." into a directory properly. Cwd::realpath does too much. It resolves all symbolic links in the path, which I do not want. Perhaps the...

Is a relative path in a CSS file relative to the CSS file?

When I reference an image or other file in a CSS file by a relative path, is the path relative to the CSS file or the HTML file using the CSS file? ...

Check if file exists, including on PATH

Given a filename in C, I want to determine whether this file exists and has execute permission on it. All I've got currently is: if( access( filename, X_OK) != 0 ) { But this wont search the PATH for files and will also match directories (which I don't want). Could anyone please help? Edit: As an alternative, seeing as I'm running e...

C# - retrieve file path from config file - @ doesn't do it's magic

Hi guys, I'm currently working on a web service that retrieves an XML message, archives it and then processes it further. The archive folder is read from the Web.config. This is what the archive method looks like private void Archive(System.Xml.XmlDocument xmlDocument) { try { string directory = System.Configuration.Con...

Bourne Shell: Convert ~/Desktop to /users/me/Desktop

The keytool does not resolve impartial directories. Ie this works: keytool -keystore "/users/me/Desktop" ... This doesn't: keytool -keystore "~/Desktop" ... Is there something that I could call like this: keytool -keystore "$(<cmd> ~/Desktop)" ... Update I guess I should actually be more specific: This is really what I am doi...

iPhone dev: Recurse all project resoureces and collect paths

I have a bunch of HTML resources in my app organized in a hierarchy like so: dirA |---> index.html |---> a1.html |---> a2.html |---> dirB |---> b1.html |---> b2.html |---> dirC |---> c5.html |---> c19.html I'm trying to collect the absolute paths of all HTML resources however deep down, but can't seem to figure...

Player/Stage Path Planning

Hey guys, So I have map and config files that represent the world in which my robot is going to be trying to get through. My robot has to get from the top left corner to the bottom right corner of the map without hitting any of the obstacles. I am allowed to work with the map data before sending the robot on it's journey to try and impl...

Is there a way to create custom pathways using the Google Maps API V3?

I need to create custom pathways using the Google Maps API V3 for a map of a campus I know I could create pre-determined paths based on checkpoints that I input, but I need to be able to make it so that a user using the map I've created can click from one side of the campus to the other, and have the option to either follow roads/sidewa...

How to execute programs in the same directory as the windows batch file?

I have in the same folder a .bat and a .exe file. I couldn't call the .exe file from the .bat unless I put the full absolute path to it. Is there a way to don't specify the path? ...

Finding most recently edited file in python

I have a set of folders, and I want to be able to run a function that will find the most recently edited file and tell me the name of the file and the folder it is in. Folder layout: root Folder A File A File B Folder B File C File D etc... Any tips to get me started as i've hit a bit of a wall...

Is there an easy method to combine two relative paths in C# ?

I want to combine two relative paths in C#. For example: string path1 = "/System/Configuration/Panels/Alpha"; string path2 = "Panels/Alpha/Data"; I want to return string result = "/System/Configuration/Panels/Alpha/Data"; I can implement this by splitting the second array and compare it in a for loop but I was wondering if there i...

compare two windows paths, one containing tilde, in python

I'm trying to use the TMP environment variable in a program. When I ask for tmp = os.path.expandvars("$TMP") I get C:\Users\STEVE~1.COO\AppData\Local\Temp Which contains the old-school, tilde form. A function I have no control over returns paths like C:\Users\steve.cooper\AppData\Local\Temp\file.txt My problem is this; I'd lik...

shell script fun! how to perform an action on each subdirectory from a given path??

I am writing a shell script (which I suck at) and I need some help. Its a script that is moving things from git to CVS (not important). The thing is, i a file path: controllers/listbuilder/setup/SubmissionRolesListbuilderHandler.inc.php and I need to be able to do: cvs add controllers; cvs add controllers/listbuilder; cvs add cont...

PHP: Extract direct sub directory from path string

I need to extract the name of the direct sub directory from a full path string. For example, say we have: $str = "dir1/dir2/dir3/dir4/filename.ext"; $dir = "dir1/dir2"; Then the name of the sub-directory in the $str path relative to $dir would be "dir3". Note that $dir never has '/' at the ends. So the function should be: $subdir ...

Mapping Absolute / Relative (Local) Paths to Absolute URLs

I need a fast and reliable way to map an absolute or relative local path (say ./images/Mafalda.jpg) to it's corresponding absolute URL, so far I've managed to come up with this: function Path($path) { if (file_exists($path) === true) { return rtrim(str_replace('\\', '/', realpath($path)), '/') . (is_dir($path) ? '/' : ''...

How to add include path in Qt Creator?

I have a project I'm working on in Qt creator that requires a third-party library. I want to add the headers to the include path for the project. How do I do this? ...

get program name in drupal

I would like to get program name in Drupal (actually name in URL that calls program or function). example: http://localhost/drupal6/my_widget This works: $myURL = (basename($_SERVER['REQUEST_URI'])); // $myURL=my_widget but not when I have additional parameters: http://localhost/drupal6/my_widget/parm1/parm2 ...

Getting path of the file that saved on Sharepoint Document library

Hi Hoe to get the full path of the file that saved on into sharepoint document library. I have one requirement, in this if i upload one file to the document library, then i want to save the Doc path of the same to the DB. please help me to implement this task. Thanks in advance.. ...

How can I list the contents of a directory in Python?

Can’t be hard, but I’m having a mental block. ...