I am passing a file path to a method. An example is the following: The method--  def example(image):      code not shown   The call to the method--  example("resources/1.png")   In this, I want to remove the "resources/" part using the example method and simply return "1.png". How can I do that?
54867
How to get the filename without the extension from a path in Python? For instance, if I had &quot;/path/to/some/file.txt&quot;, I would want &quot;file&quot;.
116673
For example, I have files named   A_1.txt A_t_1.txt A_ts_1.txt A_tsa_1.txt   in a directory ~/admin/packages/.  I am building a for loop to by globbing to A_1.txt   for f in ~/admin/packages/*_1.txt   It's obvious that this can potentially glob to any one of these files.  Specifically I would like to use an "exception" command (if it exists) to say glob to any file as long as it does not have a t, s, a before _1.txt.  EDIT: I forgot to mention that I have the path stored as a variable.  PROJECT="~/admin/packages/*_1.txt"  for f in ${PROJECT}...
29780
I am trying to convert a bunch of images to thumbnails that might be in several subdirectories, and save a copy of the image as a thumbnail inside the subdirectory, but I can't figure out the syntax. Any advice would be welcome.   convert test/*/*.jpg -50x50 test/*/*_thumb.jpg
102720
For the graphicx package, we can use \graphicspath{...} so that we can directly use filenames in the argument of \includegraphics{...}. Can a similar thing be done for directly using filenames in \input{...}. I know of the method mentioned  but if this was the way to do it, then why does \graphicspath{...} exist?
110593
I have a folder with images :  1.png 2.png 3.png ... 11000.png.   And I want to rename this files adding a p- as follows:  p-1.png p-2.png ... p-11000.png   How can I achieve this? I tried   ren *.png ???-p.*    but this is giving the opposite results.
60818
I need to test if a file is a shortcut. I'm still trying to figure out how stuff will be set up, but I might only have it's path, I might only have the actual contents of the file (as a byte[]) or I might have both.  A few complications include that I it could be in a zip file (in this cases the path will be an internal path)
96471
I need to get the path for public:// at runtime. Is there a function I can use to get it?
114872
I'm loading an image from a file, and I want to know how to validate the image before it is fully read from the file.  string filePath = "image.jpg"; Image newImage = Image.FromFile(filePath);   The problem occurs when image.jpg isn't really a jpg.  For example, if I create an empty text file and rename it to image.jpg, an OutOfMemory Exception  will be thrown when image.jpg is loaded.  I'm looking for a function that will validate an image given a stream or a file path of the image.  Example function prototype  bool IsValidImage(string fileName); bool IsValidImage(Stream imageStream);
66398
Suppose that we have a full URL of desired file e.g.        I would like to go without installing a new software. Is it possible?  Command   cp  'http://example.com/directory/4?action=AttachFile&amp;do=get&amp;target=file.tgz' hooray   doesn't work ;)
26226
I need a robust and simple way to remove illegal path and file characters from a simple string. I've used the below code but it doesn't seem to do anything, what am I missing?  using System; using System.IO;  namespace ConsoleApplication1 {     class Program     {         static void Main(string[] args)         {             string illegal = "\"M&lt;&gt;\"\\a/ry/ h**ad:&gt;&gt; a\\/:*?\"&lt;&gt;| li*tt|le|| la\"mb.?";              illegal = illegal.Trim(Path.GetInvalidFileNameChars());             illegal = illegal.Trim(Path.GetInvalidPathChars());              Console.WriteLine(illegal);             Console.ReadLine();         }     } }
101639
How can I copy the path to a folder or a file? The Info Dialog doesn't allow me to copy the information that stands there ...    Is there an easy way to do this?
27334
when we specify the file path some times we specify like ./filename and some time ../filename what is difference between these two?
58650
I have a StringProperty(subtype="FILE_PATH) and I am trying to make it so the user selects a folder and then a file is saved out to the location, but the filepath comes out looking really funky.  The folder selected is D:\Pictures, what the StringProperty shows is //..\..\. What is going on here?
10826
What does "/" , "./", "../" represent while giving path?
95118
The windows command line prompt display the full path of the currently directory, which will be too long when I am deep into a directory, like:  V:\Runtimes\ProjectName\src\ToolsTest\JavaCrashExample\JavaCrash\main\ToolsTest\JavaCrashExample\JavaCrash&gt;   Is their any way to customized this, so that I can just display the current directory's name?  Thanks.
2907
Simple enough question: is there some shell command (or GUI method) I can use that, given the path to a file on my system, tells me what package put it there? Assuming the file did in fact come from a package, that is.  Bonus question: what if it's a file that isn't installed on my system? Is there, say, a website that will let me look up a file and see what packages, if any, provide it?
53704
What I am doing is converting mp3's with LAME. I already have an old script I wrote that works but I want to add to it this ability--to no longer delete the file but instead save it in a new root folder with sub-directories that match the using the path that it is already in.  This is the code I got off the Internet that I am using in my script to get the path:   c=$FILENAME  xpath=${c%/*}   xbase=${c##*/}  xfext=${xbase##*.}  xpref=${xbase%.*}  path=${xpath}  pref=${xpref}  ext=${xfext}   The xpath and path give me the directory structure /home/user/working-root-directory/band-folder/album-name/  Using that technique, how do I script this to get just the band-folder into a separate variable and the album-folder into a separate variable?  Then I can use them to create  new folders keeping all the mp3s in band album order to put them into a different root folder; this would eliminate me from having to move them myself so the next time I run my script I will not re-sample them again because they will no longer be in the working directoy path/folders and still have a back up copy of my files just in case.