The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
3answers
68 views

Can I forbid the creation of files with certain permissions?

I have a directory with a certain group ID, and I only want files with the same ID to be in that directory. So I set the SGID bit on that directory, so that everytime a file is created inside it, it ...
1
vote
2answers
52 views

Copying Files in a Folder To Individual Folders

This might sound like something quite odd but for my HTPC, I need to rearrange how my files are stored such that each of the individual files in a folder needs to be moved to a subdirectory of its own ...
0
votes
1answer
90 views

Moving folders used wrong syntax and lost them

I thought I was being smart trying to move a folder to one level up by going: mv folder .newfolder and neglecting to even put: mv folder .newfolder/folder and anyway it didn't put up an error but ...
2
votes
3answers
653 views

Replace filename with parent folder name

I have a bunch of files each in their own subdirectory. I need to write a script to rename each file to have the same name as its directory: For example, given: ./1111/1234.pdf ./2222/2345.pdf ...
2
votes
2answers
1k views

How can I rename all files with one extension to a different extension recursively [duplicate]

Say I have a folder: / /a.bub /v.bub /dr.bub /catpictures /catpictures/or.bub /catpictures/on.bub How can I format a script to change each of these to .aaa. Here is what I've got, although it ...
2
votes
1answer
841 views

find/rename command doesn't work

I am using Linux Slackware 14.0, bash 4.2. Suppose, I have 2 files in the directory: bash-4.2$ ls 1.txt 2.txt I want to rename them to .svg. This answer is accepted and upvoted, so I think, it ...
3
votes
2answers
6k views

mv: cannot stat No such file or directory in shell script

I wrote a script to move some files form one folder to another folder but I got the following error, I checked 2 folders and notice for 1 folder there are such files and another there is no such ...
1
vote
3answers
572 views

How to rename pattern in one file to another over several directories recursively

I have several directories through which I want to recursively iterate over and change the file name of *.GEOT14246.* to *.GEOT15000.* Is there a one liner on the bash script to do this ...
1
vote
4answers
662 views

How to remove URI encoding in file names

I realise this might be quite a simple question, but I'm still quite new to the command line and only have a grasp of basic commands. I've downloaded some lecture presentations (~25 or so) from my ...
2
votes
3answers
210 views

Unix command to rename multiple files

I have some dirs with different plugin-cfg.xml files that I want to take a backup of and keep in the same dir. E.g. Plug6_a1/plugin-cfg.xml Plug6_a2/plugin-cfg.xml Plug6_a3/plugin-cfg.xml How can ...
1
vote
3answers
260 views

Remove random string from particular position in file names [duplicate]

I've downloaded dozen of files from youtube using youtube-dl. Nice feature, btw. After I searched through them all, I've realized that there are lots of ending with random numbers and letters of ...
20
votes
1answer
574 views

How to move a directory, file by file? (instead of “copy then remove”)

My computer has one 500GB drive. I want to move 400GB of data from /unencrypted to /encrypted. Both directories are on the same partition, but /encrypted is handled by ecryptfs, so mv /uncrypted/* ...
3
votes
3answers
2k views

How to move all files with a certain file extension from subdirectories to a single directory

I have a directory that contains many subdirectories. The subdirectories contain lots of types of files with different file extensions. I want to move (not copy) all the files of one type into a new ...
0
votes
2answers
894 views

Rename multiple files in UNix directory [duplicate]

I have files in unix directory in below format using sed or some other commands. Owner.Env.File_010513_1200_ver1.expdp Owner.Env.File_010513_1200_ver2.expdp Owner.Env.File_010513_1200_ver3.expdp ...
1
vote
2answers
1k views

how to change `rm` to as a command like `mv ~/ .trash` [duplicate]

I like to use rm but I often made mistakes so that I remove something mistakenly so I want to make somthing like mv .trash so that rm file is equal to mv file ~/.trash besides, I also ...
2
votes
1answer
199 views

Unable to preserve ownership in a copy but able with a move?

I have noticed that I am unable to preserve ownership if I rsync -o files. However, I am when I move them. This is all without admin privileges. What is the rationale of this? Several threads e.g. ...
1
vote
1answer
261 views

Strange behavior in mv command - maybe open sys call issue?

I'm noticing very strange behavior from the "mv" command that may (or may not) be related to the "open" system call. We're running RedHat v5. There are two separate storage devices, one mounted to ...
2
votes
2answers
387 views

Delete whitespace in filenames in directory

I have a directory where some filenames have been wrongly named something .pdf rather than something.pdf. Is there a quick one liner I can use to delete the whitespace in the filenames. I have tried ...
1
vote
3answers
467 views

Why is this Bash command using regex not replacing my brackets?

I have this command to go through all my files in my Music directory, and all subdirectories, and replace any square brackets in the file name with rounded brackets: find /home/Music/ -depth -name "* ...
1
vote
2answers
140 views

How to strip directory structure with command line (or script)

I have a large collection of files packed into a two-level directory structure with many, many, many folders. In other words, I have a folder with a great many subfolders in it. There are no ...
2
votes
3answers
178 views

What has happened to the file when I entered “mv file.txt ../”?

I wanted to move 'file.txt' one folder up, but instead of mv file.txt ../file.txt I entered mv file.txt ../. Now the file is gone and I didn't get any error message. So it seems the some action was ...
3
votes
3answers
1k views

How to change extension of all files in a directory?

There are some extensionless files in current directory (there are not dot in their names). I want to rename like so: filename -> filename.md I tried doing mv * *.md but that didn't help. I am ...
1
vote
2answers
221 views

Is it better to pass all files to mv or to run a bunch of mv processes in parallel?

I have three ways of running mv. First: mv /db/dbfile1 /db/dbfile2 /db/dbfile3 /usb_storage/ and second: mv /db/dbfile1 /usb_storage/ & mv /db/dbfile2 /usb_storage/ & mv /db/dbfile3 ...
2
votes
5answers
219 views

move a directory with a single character (back quote) as its name [duplicate]

How can I move a directory whose name is just a space? ls -lah drwx------ 4 user1 user1 8.0K Mar 13 14:16 . drwxr-xr-x 3 root root 60 Mar 13 13:48 .. drwx------ 18 user1 user1 4.0K Mar 13 11:18 ...
1
vote
2answers
100 views

renaming a directory and its subdirs without affecting their files

I have to rename directories under the root directory with prefix "ms_PF" and then rename their subdirectories with the modified name of the main directory with an extra "_", and then copy all ...
1
vote
1answer
59 views

How rename directories tree entry by entry

I have text file contain two columns: current directory name the new name of the last entry d_7154/d_7161/ 'Main Integration' ...
1
vote
1answer
40 views

Can one move a relpath in one command?

This question is similar to one I asked recently, but the answers to that question, for the most part, do not extend to this one, AFAICT. The main difference between the two questions is that the ...
2
votes
1answer
307 views

Minimal command to make a copy of a file [duplicate]

I often find myself copy-pasting long path in order to create a copy of a file cp /path/to/file/file1 /path/to/file/file1.bkp Is there an alternative utility that will NOT require me to type the ...
2
votes
1answer
1k views

Create sub-directories and organize files by date

I have some directories of files copied from my security camera that I would like to organize into sub-directories by file date. So for example; -rwxrwxrwx 0 root root 4935241 Jul 19 2012 ...
4
votes
3answers
1k views

Backup file with .bak _before_ filename extension

I commonly backup config files on servers without version control like so: # cp httpd.conf{,.bak} # ls httpd.conf httpd.conf.bak However, for files in the web root I take the time to carefully ...
1
vote
3answers
396 views

Recursively edit files based on parent directory's name

I'm facing an issue I'm not quite sure how to overcome. I have a large directory with hundreds of folders, all following the naming scheme "a_b_x", with x being a random word. In every one of these ...
4
votes
2answers
333 views

Is it possible to rename Thunar's side pane default items?

I would like to display a different name of these items - that would indicate for example that one is windows partition, other ubuntu, etc. Is it feasible?
1
vote
2answers
164 views

How to move files from one directory to a nested directory using SSH?

I'm new to SSH. I would like to know how to move all the files, not the folder or directory, to an existing folder or directory two levels down.
7
votes
4answers
559 views

mv * folder (avoiding 'cannot move' error) [duplicate]

Anytime I want to move thousands of files to a new folder, I always encounter the same problem. > mkdir my_folder > mv * my_folder mv: cannot move 'my_folder to a subdirectory of itself ...
6
votes
1answer
893 views

Rename current file in vim

Searching over net shows :f filename would rename the current file in vim. But executing this and later exiting vim, shows the new file with all the contents and also the old file is present with the ...
1
vote
2answers
169 views

How to “grab” matching files from a lookup file in bash?

I have a lookup file containing filenames. I also have a directory containing files, some of which have the names that correspond to some of the names in the directory. How can I: Move exact ...
0
votes
1answer
128 views

Alter path of find result [duplicate]

Possible Duplicate: Manipulate file name piped from find command How can I alter the path of a file found with find before I run an exec on it? I want to find files and then mv them to a ...
9
votes
3answers
769 views

How to decide that mv moves into a directory rather than replacing directory?

Say I have a directory /hello. Then I do mv /hello /hello2. Am I moving /hello into /hello2/hello? Or am I moving /hello to /hello2? It seems that when I do something like this, I get inconsistent ...
2
votes
3answers
537 views

Renaming Files according to Pattern [duplicate]

Possible Duplicate: Batch renaming files Let us assume that I have six files named: 1.a, 1.b, 1.c 2.a, 2.b, 2.c where a,b,c are file extensions like sh, txt etc. Now, I want to rename ...
3
votes
3answers
915 views

How do I remove carriage returns from directory names?

I created a file in Excel and ftp'd the file over to my Linux machine. In the file were a bunch of mkdir commands. Now all of the newly created directories have a carriage return at the end of them. ...
1
vote
1answer
454 views

Help renaming folder according to date

I have the folder "Backup yzT Jan-01-2013". I've made also a script for do a backup everyday. The problem I'm facing is how to rename the folder day by day according to date? Get the new name is ...
4
votes
3answers
3k views

Preserve directory structure when moving files using find

I have created the following script that move old days files as defined from source directory to destination directory. It is working perfectly. #!/bin/bash echo "Enter Your Source Directory" read ...
1
vote
1answer
255 views

Move files to mapped network folder

I was wanting to know the best or preferred way to move files from one computer to a networked hot folder. I have looked at mv and cd but all the references discuss using it locally. I would need to ...
0
votes
2answers
109 views

Including a date in a filename

Inside a directory, there are 150 files named like ABLIMITS.TXT. How do I rename them to ABLIMITS_date.txt prompting the user for date?
4
votes
2answers
227 views

Copy files with deleting suffix in name

How can be done coping files that have some suffix at the end, into same dir with the smallest command possible: Example have directory containing files: cassandra.yml.example database.yml.example ...
1
vote
4answers
1k views

How to rename files with sed and csv

I'm new with Linux, sed, and awk but I don't mind challenging myself on new ideas. That being said, I understand the purpose and how to use rename and sed for a common event such as adding a $date or ...
3
votes
3answers
416 views

Rename multiple directories decrementing sequence number?

I have a directory which contains a number of subdirectories with names on the format dir.##. The prefix is always the same, and the suffix is 1-3 digits in a strictly incrementing sequence. Thus, ...
1
vote
3answers
166 views

How to move all files plus hidden to folder down?

I want to move all my drupal files in www folder to html folder. I don't know how to do this in terminal and I'm not sure if all folder and files including hidden ones are drupal in the www folder, is ...
2
votes
2answers
187 views

How do I rename multiple files [duplicate]

Possible Duplicate: How can I rename a lot of files using a regex? I've got some files named abc-10.5.3.1-1.x86_64.rpm abc-compiler-10.5.3.1-1.x86_64.rpm abc-10.5.3.1-6.x86_64.rpm ...
7
votes
3answers
3k views

adding text to filename before extension

I would like to add text to the end of filename but before the extension. Right now I am trying, for f in *.shp; do echo $f_poly; done the output is, Quercus_acutifolia.shp_poly ...