In a subfolder of my home dir, There is a file called '-r'  -rw-r--r-- 1 pi pi 10240 Sep 15 18:19 ./prog_python/-r   I don't even know why.  I would like to rename the file or delete it, but nothing like rename '/-r' newName or rename '\-r' newName works. Any advice ? Thanks !
1688
How do you remove a file whose filename begins with a dash (hyphen or minus) -?  I'm ssh'd into a remote OSX server and I have this file in my directory:  tohru:~ $ ls -l total 8 -rw-r--r--    1 me  staff  1352 Aug 18 14:33 --help ...   How in the world can I delete --help from a CLI?  This issue is something that I come across in different forms on occasion, these files are easy to create, but hard to get rid of.  I have tried using backslash  rm \-\-help   I have tried quotes  rm "--help"   How do I prevent the minus (dash or hyphen) character to be interpreted as an option?
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.
72845
I have a directory with 1000+ files. In a text file, I have about 50 filenames, one per line. I'd like to delete all the files in the directory whose filenames don't correspond with an entry on the list. What's the best way to do this? I started a shell script, but couldn't determine the proper command to determine in the filename is on the list. Thanks.
80649
I have a list of files in a folder, which I will like to rename according to a textfile. For example:  These are the 5 files in the folder.  101_T1.nii 107_T1.nii  109_T1.nii 118_T1.nii 120_T1.nii   I will like to have them rename using a text file containing a list of new filenames in the same order, without the extension .nii:  n01 n02 n03 n04 n05   How may I go about doing so?
61637
I don't remember exactly how this directory got created. It's name is ~, the alternative we all use for home diretory. I also see a sticky bit attached with this directory. How shall I delete it? I fear running a normal rmdir would delete all the files from the home directory recursively. Here are the details :  mtk4@laptop:~/temp$ ls -l total 4 drwxrwxr-t 2 mtk4 mtk4 4096 Oct 17 2011 ~   How shall I proceed?  Another question : What does the total number specify on the first line of output of ls -l ? '4' in this case. There is just 1 directory as shown(other than . and ..).   I am using ubuntu 12.04.  Also asked same question on , as it seems to be relavant on both sites.
14457
I'm trying to get rid of everything before the filename ex:  /home/mike/whatever/test_1.txt   leaving only test_1.txt  what would the simplest way?  thanks
16606
On my Windows 7 machine, when I make a copy (Ctrl+C, Ctrl+V) of a file in the same folder I get the new file created with " - Copy" added to the file name:  1st copy: "foo.txt" -> "foo - Copy.txt". 2nd copy and so on: "foo.txt" -> "foo - Copy (2).txt".  Is there a way to change this naming pattern?  Particularly I'm interested in changing the naming from " - Copy (index)" to "_index", so that the files would be named foo_1.txt, foo_2.txt and so on.  I know there are 3rd party file managers that can do this, but I would like to know if there is a way to change this naming pattern in explorer.
8029
I've searched the net for such information and found different command lines, like these ones:  sudo apt-get remove application sudo apt-get remove application*  sudo apt-get remove --purge application sudo apt-get remove --purge application*  sudo apt-get purge application sudo apt-get purge application*   So, what is the correct way? Is it necessary to use that "*"?  After that, I also found these commands:  sudo updatedb sudo locate application sudo rm -rf (file/folder name)
13057
I have this directory /foo/bar/. Inside, I have a python file named myfile.py. I made it executable by adding (at the top):  #!/usr/bin/env python   Then, I made it executable by issuing   chmod +x myfile.py   I edited my path by issuing  sudo nano /etc/paths   I added /foo/bar/ to it.  The problem is that although I can run myfile.py by typing ./myfile.py while I am inside /foo/bar/, it doesn't work from any other location. What am I doing wrong?  Thank you.
13709
I need to rename the following:  file_001_loremipsum.png file_002_dolor.png file_003_sit.png file_004_amet.png file_105_randomness.png   into  upl_loremipsum.png upl_dolor.png upl_sit.png upl_amet.png upl_randomness.png   How do I make it happen with just one simple line of terminal command?
25249
I realized I had named a bunch of files in an off-by-one fashion so I wanted to rename any file starting with "1" to the same thing except starting with 2.  For example mv 1.4.5.txt 2.4.5.txt or mv 1-chart.jpg 2-chart.jpg etc.  I tried mv 1* 2* but this was not accepted because it interprets 2* as a directory.
113641
I have a folder containing like 1500 files, I want to rename them automatically via the terminal or a shell script as follows: "prefix_number.extension". Example: cin_1.jpg, cin_2.png ...
111308
I have a directory structure as below:  Folder   &gt; SubFolder1     &gt; FileName1.abc     &gt; Filename2.abc     &gt; .............    &gt; SubFolder2     &gt; FileName11.abc     &gt; Filename12.abc     &gt; ..............    &gt; ..........   etc. I want to rename the files inside the subfolders as:  SubFolder1_Filename1.abc SubFolder1_Filename2.abc SubFolder2_Filename11.abc SubFolder2_Filename12.abc   i.e. add the folder name at the beginning of the file name with the delimiter "_". The directory structure should remain unchanged. Note: Beginning of file name is same. e.g. in above case File*.  I made below Script     for /r "PATH" %%G in (.) do (   pushd %%G   for %%* in (.) do  set MyDir=%%~n*    FOR %%v IN (File*.*) DO REN %%v  "%MyDir%_%%v"    popd   )      Problem with the above script is that it is taking only one Subfolder name and placing it to the beginning of file name irrespective of the folder.
74158
So, Im working in a UNIX environment and I noticed that inside my working directory, which is miles miles away from my UNIX home, there is a ~.  Now, once in the past, I did rm -rf ~ from my working directory and ended up erasing my home directory completely and had to involve IT.  I do not want to do it again. At the same time, I want to know   Why is ~ created in my working directory? Is it a faulty finger slip while saving (:w! but what happens is :w~ ?!!) Before checking in, there is a script that looks for extra files or folders that p4 is not aware so def this ~ might cause an issue. So how can I remove the ~ from my working directory and at the same time not erase my home?   I do have a backup command called del that I use instead of rm -rf. It just places stuff in a temporary location. I could use that and get rid of the ~. But I'm more interested in knowing why this happens, and how I can remove it?
12086
root@server # tar fcz bkup.tar.gz /home/foo/ tar: Removing leading `/' from member names   How can I solve this problem and keep the / on file names ?
89541
I would like to rename all files in a folder so to have consecutive numbers. For instance:  1.png 2.png 3.png etc   I know there is the rename command and I know there are DOZENS of similar questions in here but I can't find the way.  NOTE: Suggested duplicate doesn't contain a solution specific for my case. Please stop flagging this as duplicate, because suggested duplicate does not answer my question
100037
I have a file named .ignore. In need to replace the projdir. For example:  ignore \..* ignore README projdir Snake   I need to replace Snake with, for example, "PacMan". I read the man page, but I have no idea what to do.