The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
2answers
175 views

Moving large numbers of files and directories to a different directory

I'm trying to move the following move a large number of files that exist in the following structure to a /mnt/originals but I need to maintain the structure at the same time. I know cp would be a ...
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 ...
3
votes
3answers
493 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 ...
3
votes
2answers
638 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 ...
3
votes
3answers
521 views

Rename the last 8 characters in filename

I am receiving video files with different names but the final 8 characters of all are numbers (also different every time). This is the pattern of the file name: custom text 00030402.avi I have to ...
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, ...
3
votes
1answer
738 views

Can't rename a directory that I own

I have a directory with a big load of sub directories. I own all of them, and the permissions are all 777. pascal@azazel /box $ ls -al total 147872 drwxr-xr-x 293 root root 12288 aoû 22 19:44 ...
3
votes
6answers
4k views

Renaming multiple files based on their contents

How can I rename all files within a folder with the first word of their content? For example if a.txt contains “Unix is an OS” in its first line then a.txt should be renamed to Unix.txt
3
votes
3answers
58 views

Moving an open file to a different device

I have an application running that is generating a large (~200GB) output file, and takes about 35 hours to run (currently I'm about 12 hours in). The application just opens the file once then keeps it ...
3
votes
3answers
271 views

Shell Script to move folders containing a specific word

I'm searching for an simple shell script to mv all folders in /var/www/uploads/ that containing Math or Physics in the name to /mnt/Backup/. I've never done something like that before, due to the ...
3
votes
4answers
131 views

Batch file rename with substitution lookup

Using bash, how I can batch rename a large number of files, where I need to construct a new name for each file, based on its existing name and a 'contextual map' - don't know what else to call it – of ...
3
votes
3answers
346 views

Adding prefixes/suffixes to file names without typing it all over again?

I would like to do something like the following $ tmp=name* $ mv $tmp new_$tmp $ ls new_* $ new_name-with-stuff-i-dont-want-to-type name-with-stuff-i-dont-want-to-type Setting the environment ...
3
votes
3answers
388 views

Batch rename files with unknown names and unknown extensions

I have a bunch of pictures, some are .jpg, some are .png. any given picture could have an entirely random name (possibly including spaces). in any given directory, how can I rename all of them, ...
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 ...
3
votes
3answers
523 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
3answers
57 views

How can I use rename to recursively rename everyting to uppercase

I'd like to recursively rename all files and folders (sub-folders) to uppercase. I found some scripts that will do it to lowercase, but I don't know how to change them so it will do it the other way ...
3
votes
3answers
95 views

Change the name of a file that contains spaces in the name

I don't know why but when I go to change this file name with mv command it comes up with the error stating not a directory. -bash-4.1# mv {{ THEME SANITIZED }}.hacks.css myomega.hacks.css
3
votes
4answers
188 views

how to rename files while copying?

How would I copy (archive style where date isn't changed) all the files in a backup directory to the user's directory while renaming each file to remove the random string portion from the name (i.e., ...
3
votes
3answers
2k views

Rename multiple directories

I want to find all directories with the last subdirectory named doc, for then rename them to Doc. How can be renamed? I've the first part: find -type d -name 'doc' which returns directories paths ...
3
votes
2answers
544 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
1k 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. ...
3
votes
2answers
350 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 ...
3
votes
2answers
168 views

How to force overwrite non-empty directories using `mv`

I am wanting to move (not just copy) a group of files/directories to a different directory some of which have name clashes with files/directories in the target directory. My main objective is to move ...
3
votes
3answers
341 views

Rename multiple files, sub directories, and insert characters at specific location on OSX

I have files and directories starting with "cateory-icon-" in many sub directories. I am trying to rename them recursively to "category-icons-". Please note that I added missing "g" to the category ...
3
votes
2answers
454 views

How to copy multiple files but keep their extensions the same?

I am looping through a number of files, and $file represents the current file. How can I make copies or renames and keep the extension the same for this current file? e.g. if $file = x.jpg How to ...
3
votes
2answers
859 views

Automatically moving files to a directory, one by one, and only when the target folder is empty

Is it possible? And in reverse alphabetical order? Essentially, this: How can I move files by type recursively from a directory and its sub-directories to another directory? Except that each file is ...
3
votes
1answer
1k views

Using regex in ls and mv

I have a directory structure like this ├── UK │   ├── BuyBand_go_UK.png │   ├── BuyBand_go_UK.svg │   ├── BuyBand_K.png │   ├── BuyBand_K.svg │   ├── BuyBago_UK.png │   ├── BuyBago_UK.svg │   ├── ...
3
votes
1answer
1k views

When we use mv command, what changes take place in HDD?

Under following conditions- mv within the same HDD partition mv to a different partition in the same HDD mv to a different device (e.g. USB HDD) Is the complete file moved or is it a very small ...
3
votes
2answers
338 views

rename randomly files on a USB device

I would like to rename all of my files of my USB device randomly. Indeed, in my car, my tuner has not the random function. I think I can do it with PHP ... but I'm pretty sure it is possible to do ...
3
votes
1answer
2k views

Gunzip multiple files and rename them

I want to know whether it is possible to gunzip multiple files and rename them with one command/script. I have a bunch of files in the format: test.20120708191601.DAT.3599502593.gz ...
3
votes
2answers
892 views

How do I find a bunch of files with a string in its filename (or body text) and then move all those files to a specific folder?

Say - what if I wanted to move every HTML file in several independent directories with the word "heavengames" in its filename (and as a second question, every HTML files with the word "heavengames" in ...
3
votes
1answer
347 views

Multiple renaming files [duplicate]

Possible Duplicate: How to clean up file extensions? I'd like to rename files with extension .flac.mp3 to extension .mp3. I used the following command $ for i in *; do mv $i `echo $i | sed ...
3
votes
2answers
297 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 ...
3
votes
3answers
914 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. ...
3
votes
2answers
798 views

How do I get this find and rename command to work with subdirectories? [duplicate]

Possible Duplicate: Recursive rename files and directories I have a large directory of music files that is often changing as files and directories come and go. My preference is to make sure ...
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 | ...
3
votes
1answer
101 views

Rename files with spaces in a BusyBox shell

I'm trying to rename some files on my Synology Diskstation via SSH. The available shell is the BusyBox built-in shell: BusyBox v1.16.1 (2013-04-16 20:13:10 CST) built-in shell (ash) The move ...
3
votes
2answers
38 views

Overriding amended time stamps

I need to make it so the files in current directory get amended with a timestamp. It works fine for the first time, but once I run it again it adds another timestamp to the file. I need a way to ...
3
votes
5answers
430 views

Flatten Directory but Preserve Directory Names in New Filename

How can I flatten a directory in the following format? Before: ./aaa/bbb/ccc.png After: ./aaa-bbb-ccc.png
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 ...
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 ...
2
votes
3answers
176 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 ...
2
votes
3answers
1k views

sorting filenames numerically when they have non-numeric prefix

I have files in the following format: x1 x2 ... x10 x11 ... x101 ... I want to rename these files, so they all have the same name length: x001 x002 ... x010 ... I can do this with files, that don't ...
2
votes
1answer
306 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
2answers
101 views

How to rename filename with ' or ? in file name?

I have a problem renaming a file that I'm not even sure which special characters I have in the file. I'm using CentOS 6 64bit. When I ls the file: Giko Suzo San?e - Ep1.avi but when view it in ...
2
votes
1answer
273 views

How to rename /dev/sdax(partitions) in Linux

I made a partition like /part on my machine with some important data... But I can't stand the name of it... I want a clear solution to resolve it and change the name of it to for example /test... ...
2
votes
5answers
175 views

Rename files in directory

How to rename files in a directory such as the following file: PMC21375.pdf.txt, I need to be renamed to 21375.txt. i.e, I need to remove both PMC and pdf from each file name.
2
votes
3answers
413 views

Batch File Rename Using Mapping File

I have a large collection of image files, for example: a.png, b.png, c.png, etc If I have a file with mappings of filenames to numbers, like so (ignore the format, it could be anything): a=>1 ...
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 ...