The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
4k views

Batch copying/moving files in unix?

Is there a way to batch copy/move files in unix? I thought it might be an option for cp/mv but I can't find any way to do it.
3
votes
3answers
1k views

Removing apostrophe from all file names

I tried to remove apostrophe from all files' names in the directory. for i in *; do mv $i `echo $i | tr -d "'"`; done After executing this command nothing is renamed. Do you know what's wrong ...
5
votes
4answers
2k views

Recursively rename subdirectories that match a regex

I have a media server with a folder called Series. (/media/Expansion2/Series/) In it, I have (surprise!) TV series. These are just the show names, e.g., /media/Expansion2/Series/The Big Bang Theory/ ...
5
votes
4answers
757 views

For each subfolder, sort files by name and rename them to sequential padded numbers (regardless of extension)

I have the following directory structure: . ├── event-a │   ├── album-a │   │   ├── a.jpg │   │   └── x.png │   └── album-b │   ├── a.jpg │   ├── x.png │   └── y.gif └── event-b ├── ...
3
votes
3answers
514 views

Unique file name for different files

I'm working with graphic design. I've downloaded many files (EPS files, PSD files, etc) from various websites. Because it come from various websites, after downloaded from more than 10 different ...
2
votes
2answers
3k views

Move huge number of files into date structured directory order

I have about 1 million files in this directory: /home/username/images/ Each of the files are called something like: 012345678910(Place)_0_20120414185957_28841.jpg with the timestamp part of the ...
2
votes
1answer
288 views

Renaming a bunch of files but keeping the number part

I have a bunch of files like this: pic100.png pig102.png box103a.png superb103b.png px103c.png rotor110 - new.png ready1323 (yellow car).png motorhome1036x red circle.png ... so, you can notice ...
25
votes
4answers
1k views

Quick way to include a directory path when calling mv? [duplicate]

Often I will work out of the root of a rails directory where I find my self navigating the same path twice every time I would like to move a file: mv app/views/layouts/application.html.erb ...
3
votes
3answers
530 views

pull out a file named to ~

So I have downloaded a music album from aMule and it is located in the .aMule/Incoming directory. I tried to move it out with the following command: mv albumName.rar ~ This left me with a file ~ ...
3
votes
2answers
2k views

UNIX move file name with sysdate

I want to make a script in Unix in which I have to move a file daily to a specific path. In order to avoid overlapping of the file, I want the file name along with the date. e.g. mv filename ...
3
votes
2answers
5k views

How to rename multiple files by removing the extension?

I have a number of tiff files named: sw.001.tif sw.002.tif ... and I want to remove the .tif at the end of each of the files. How can I use the rename command to do this?
1
vote
2answers
675 views

Bulk rename files with numbering

How do I bulk rename multiple files named Image401.jpg, Image402.jpg,... to Image 001.jpg, Image002.jpg, ... ?
2
votes
3answers
457 views

Rename a lot of files with all types of characters, with POSIX portability

Sometimes I need to rename all the files (the renaming convention follows later) in a directory where the filename is always in the form of 'filenamename.extension' (extension always exists and ...
1
vote
3answers
482 views

How to move files into newly created directory on condition in shell/perl

It was a mess of music files and directory. It is needed to perform the below operation over multiple directories at once: If the directory contains ".jpg" files, then create a new directory ...
1
vote
2answers
8k views

how can I rename multiple files by removing a character or string?

As a follow-up to my previous question, if I have multiple files of the form sw.ras.001 sw.ras.002 sw.ras.003 … What command can I use to remove the ras. in the middle of all the files?
3
votes
3answers
936 views

how can I rename multiple files by inserting a character?

I have many files of the form sw001 sw002 sw003 ... I want to insert a period between the sw's and the number values. How can I accomplish this?
1
vote
3answers
1k views

How can we rename a file with semi-colon as part of the filename?

I tried to rename all file with extension "XLS;1" to "XLS" but it just didn't work. I tried the following in cygwin in windows xp and they don't work: mv *.XLS;1 *.XLS mv *.XLS\;1 *.XLS mv ...
4
votes
6answers
3k views

Linux script or program to shorten filenames

I haven't had much success in finding a Linux version of namemangler, which I need to rename 1000 of files so they are readable on Windows. Does anyone know of a Linux program that can do this? If ...
1
vote
1answer
347 views

Can I get the backup option of cp and mv to work with directories?

--backup[=CONTROL] make a backup of each existing destination file The man page does say that it works on file. It doesn't seem to have any effect on directories. Is there anyway to make this ...
4
votes
1answer
376 views

Renaming files from bash in linux

There is a bunch of files of the following format hh-mm-ss.png where hh, mm, ss are hour, minute and second. How can I rename all these files in the directory in a sequential way from 1.png til n.png ...
1
vote
1answer
972 views

Insert selected filename while copying in Midnight Commander

Is it possible to paste the selected filename into the copy popup, so when I hit F5 this filename will be in the 'to' section, so I can adjust it? For example: I want to copy ...
2
votes
1answer
117 views

/etc/rc*: Why does this command stop NFS services from starting at boot?

I recently found this home networking tutorial surprisingly enlightening. However, there is one thing I don't understand: Disabling NFS Start On Boot: If you are not planning on regularly ...
7
votes
3answers
11k views

How can you move (or copy) all files of a certain type to a directory in Unix?

I'm not very familiar with all the tricks of grep/find/awk/xargs quite yet. I have some files matching a particular pattern, say *.xxx. These files are in random places throughout a certain ...
5
votes
1answer
3k views

mv file without write permission to the source file

I just realised that I can move a file that I do not own and don't have write permissions on. I have write permissions to the directory, so I am guessing that is why I could move it, but in this ...
1
vote
3answers
2k views

rename multiple files with rename command? [duplicate]

Possible Duplicate: How can I rename a lot of files using a regex? Rename All Files with a Certain Name There are files with ORDER_EVENTS_SOMETHING_20120117.log ...
4
votes
2answers
222 views

Can I move a directory with open files?

Imagine a bunch of processes using a /home/user/logs directory. They have some logs open for a longer time.
2
votes
3answers
5k views

Batch renaming files with pattern

I have some files named like these: 63018933.mp4?token=1325697436_b0c3e70c6e339380b4a484c576a8c287 63808488.mp4?token=1325697401_4ae5f7a68d93873c8881b303e7655e14 How do I rename all them to, for ...
8
votes
3answers
3k views

How can I use ms-dos style wildcards with ls and mv?

I have the misfortune of coming from a MS-DOS background - but at least it makes me appreciate how much more powerful Linux is. I've been working on getting my Linux-Fu up to par, but there are a ...
4
votes
2answers
764 views

mv on a glob pattern does not work without sudo

I am using MySQL database on Ubuntu machine. My MySQL data directory is /var/lib/mysql/ , since I have a database named "db_test" , so, I have a directory named db_test/ under /var/lib/mysql/ . And ...
3
votes
2answers
571 views

Simple shell script needed to move database files

I am using MySQL on Ubuntu machine. I need to physically move around the database files under /var/lib/mysql/ (this is where all the databases directories are located). Say I have two databases, ...
3
votes
1answer
2k views

Rename All Files with a Certain Name

I'm trying to find certain files with the name "stringx" and replace the name (but not the extension) with "stringy". So basically for stringx.txt and stingx.cs, I'd want stringy.txt and stringy.cs. ...
6
votes
2answers
3k views

How can I rename a lot of files using a regex?

I want to rename a lot of files on Mac OS X (10.7.2).. I don't have the perl package for the rename command. My files have names like "T452-102456-0.png" and I want to delete the "-0" part. I know I ...
3
votes
2answers
664 views

Move with possible rename

Is it possible to construct a command that will move the file to another directory and if the same file is already there, generate some random string that is not in the name of some file in the ...
4
votes
2answers
9k views

How can I move a directory onto an existing directory?

I need to essentially merge changes on two trees, applying the changes from branch 2 to branch 1. I have trees like this: media ├── cd │   ├── 0 │   │   ├── file1 │   │   ├── file2 │   │   └── file3 ...
7
votes
1answer
3k views

Why can't I have a folder and a file with the same name?

I've never had this problem before, but for some reason, I can't rename my folder to packages/. This is the structure: root - packages_old/ - packages When I try to rename the folder with ...
1
vote
3answers
3k views

Rename Multiple files and add date before the files

I have a folder contains one or more tar.gz files. I want to add current date before each files when the script run. For example: Two file name(those files will be created each day, but the name ...
3
votes
5answers
2k views

Padding a number in a filename to a fixed length

I have a directory of files such as: file.1.png file.2.png … file.10.png … file.1000.png file.1001.png … How can I pad the number to 4 digits? It should end up like this: file.0001.png ...
4
votes
1answer
901 views

Renaming files to have lower case extensions with 'rename'

I'm trying to currently rename a large set of files and have been using quite kludgy methods to do so, such as: rename 's:(.*)\.MOV:$1.mov:g' *.MOV rename 's:(.*)\.JPG:$1.jpg:g' *.JPG What I'd ...
3
votes
5answers
14k views

Changing extension to multiple files

I would like to change file extension from *.txt file to *.text file, tried using the basename command, but I am having trouble on changing more than 1 file, I am getting a basename: too many ...
12
votes
5answers
19k views

Move folder content up one level

I have a directory that is unpacked, but is in a folder. How can I move the contents up one level? I am accessing CentOS via SSH.
5
votes
1answer
1k views

zmv for zsh: Dry runs and man pages

I've heard great things about zmv in zsh, and would love to really learn to use it. However, I am still relatively unexperienced in zsh, and have some basic questions: Is there is a man page for zmv ...
9
votes
2answers
2k views

mv a file without breaking a symlink to that file

Is it possible to mv a file w/out breaking a symbolic link to that file? My initial response to this is no, and I'm working out a script based solution to change the links immediately following the ...
5
votes
2answers
289 views

mv filename .. (Where will the file go?)

[root@localhost /home/chankey/Desktop/Downloads]# ls myproject.plx [root@localhost /home/chankey/Desktop/Downloads]# mv myproject.plx .. I had the file in Downloads folder. I used mv command as ...
3
votes
2answers
303 views

Organizing messy folder based on filetype

I have music lying on my desktop and in my downloads and Music folders. Similarly, I have .odt files lying all over my home folder (mainly desktop). Is there a tool (preferably GUI so my parents can ...
18
votes
6answers
13k views

How to replace one char with another in all filenames of the current directories?

How do you rename all files/subdirs in the current folder? Lets say, I have many files and subdirs that are with spaces and I want to replace all the spaces with an underscore. File 1 File 2 File 3 ...
2
votes
3answers
566 views

Rename files with random characters from sha1sum. Does it unique?

I'm using this command to rename files with random characters from sha1sum and move all files from subdirectories to current directory: for fname in `find . -type f`; do mv "$fname" $(echo "$fname" | ...
5
votes
5answers
3k views

Recursive rename files and directories

I'm using below command for fname in *; do mv "$fname" $(echo "$fname" | sha1sum | cut -f1 -d' ') done ..but it only rename in current directory. Lets say I have many directories, and each ...
3
votes
4answers
2k views

rename character “â” of directory name?

I'm trying to rename rename character â of directory name to be blank. For example, directory with name how-â8093-to. This is the command I use, including some other modification find . -type d | ...
4
votes
3answers
3k views

How do I move some but not all files from one directory to another?

I need to move my files from one directory to other. But there is some issues. My file name pattern is like: apple.0, apple.<n>, n -> {0,1,2,3 ...~ } so mv apple.* will not work, because ...
3
votes
2answers
360 views

Splitting a large directory tree by file type

I have a large data directory (20-30Gb) on my Ubuntu 10.10 desktop machine that consists of many raw data files, processed data files, and assorted scripts, tables, figures etc. generated from the ...