The tag has no wiki summary.

learn more… | top users | synonyms (1)

11
votes
3answers
259 views

Move files and change ownership at the sametime

On Linux (Debian, Ubuntu Mint...), Is there any option command or something that I can use to transfer files to another user without having to do : sudo mv /home/poney/folderfulloffiles ...
4
votes
2answers
33 views

Faster way to rename duplicate files (identified by fdupes) in another directory?

I have a directory full of pdf files of journal articles, most of which are named by their bibtex key. Some time ago I made a backup on an external hard drive, but I haven't kept it up to date and ...
2
votes
3answers
51 views

Renaming file which got a quote mark ' in its name

I got a little bit of a problem. One client tasked me with the migration of sites from a really old server. Don't know how they got there, but there are files with ' in their names. Is there any way ...
0
votes
4answers
46 views

Mass mv on files and changing filenames [duplicate]

I want to change these filenames download (19).download ... download (27).download to download (19).html ... download (27).html I run unsuccessfully mv *.download *.html usage: mv [-f | -i | ...
0
votes
2answers
31 views

How to rename multiple files [duplicate]

I have files with names as, A2002185.h23v04.005.2007177004246.hdf A2002201.h23v04.005.2008288062542.hdf I want to rename them by deleting everything in the name after first dot (and have names as ...
2
votes
2answers
67 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
2answers
62 views

Shell Scripting: how to use part of the file path as the file name?

I have a group of directories, each containing exactly 1 jpeg image, like so- /psds/folder1/image.jpg /psds/someotherfolder/picture.jpg /psds/yetanotherfolder/thumbnail.jpg What is the appropriate ...
3
votes
3answers
57 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
0
votes
4answers
202 views

Rename multiples files using Bash scripting

I want to rename multiple files in the same directory using Bash scripting. Names of the files are as follows: file2602201409853.p file0901201437404.p file0901201438761.p file1003201410069.p ...
1
vote
2answers
90 views

cp and mv if the file named already exists

What happens when you give the following commands if the file named done already exists? $ cp to_do done $ mv to_do done
1
vote
2answers
37 views

moving files of certain formats from subdirectoris to directories with same folder names

I’ve got a weird situation. I have 100s of folders with flac and mp3 copies of the same tracks. I need to separate the mp3s from the flacs and put them into similarly named directories. for example: ...
2
votes
0answers
42 views

Batch mv cronjob leaving some (not all) copies in source

I have a cronjob that runs every 5 minutes, looking for wavs and mp3s of the same name in a source directory and if it finds a corresponding pair, it moves both to a destination directory. The script ...
1
vote
1answer
52 views

How do I rename lots of files on a directory without changing their extensions? [duplicate]

I have a problem! I have a bunch of image files with extensions. Jpg and. Png. I wrote a script that renames the files, changing their names in a pattern followed by a number like this: ... ...
12
votes
6answers
629 views

Subtract 1 from all file names (rename them) in a directory.

I have a directory which contains image files with names like image1.jpg image2.jpg image3.jpg ... Unfortunately, the image names must be zero based, so image1.jpg should be image0.jpg, ...
-1
votes
4answers
64 views

command to mass rename files according to pattern [closed]

I have a lot of files in a directory that are named as follows ID_OTHER_STUFF.txt I'd like to rename them all to ID.txt. This isn't a duplicate because I don't know how to specify this pattern.
3
votes
2answers
110 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
122 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
63 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., ...
1
vote
4answers
77 views

move file by list in file

I have a file the contain filenames, for example: /tmp/list.txt (it is with the spaces at the start of each line): /tmp/file.log /app/nir/home.txt /etc/config.cust I want, using one line, ...
2
votes
1answer
122 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... ...
3
votes
7answers
387 views

Batch renaming of files [duplicate]

I have a directory full of images: DSCN4749.JPG DSCN4750.JPG DSCN4892.JPG ... And I would like a one-liner to rename them to (say). dscn4749.jpg dscn4750.jpg dscn4892.jpg ... How do I do this? ...
1
vote
2answers
145 views

How to batch clean filenames containing invalid characters

I have a larger directory with files whose filenames contain special characters such as line breaks. The origin of these characters is seemingly that I copied and pasted text from within pdf files ...
3
votes
2answers
57 views

Trimming Filenames from the end

I have a folder with following mp4 file which are needed to be renamed for filename in /media/usama/CRUNCH/RO_Plant/RO_Videos/*; do File1=$filename echo $File1 done ...
6
votes
5answers
178 views

rename files in batch

During importing my music files from backup (thanks to default naming scheme of rhythmbox), I have messed up the file names. Now the looks like: 00 - American Pie.ogg.ogg.ogg.ogg 00 - American ...
4
votes
2answers
241 views

renaming images to include creation date in name

When I look at the properties of an image, I can see the date the photo was taken in "Date Taken". When I edit the images (proprietary program) this data gets lost. How can I rename the image files ...
1
vote
3answers
257 views

Remove whitespace and parentheses in filenames with sed [duplicate]

I'm an absolute newbie in the unix area so forgive me off the bat if I've gone about this the wrong way. I have a series of files I need to rename which all have the pattern " (*)" in them. Eg; ...
1
vote
3answers
56 views

Adding timestamp to file/dir name

I am trying to write a script, that will copy file or directory with added timestamp to filename/dirname Something like: cover.jpg --> cover_18-01-2014_17:37:32.jpg directory --> ...
1
vote
2answers
69 views

Renaming folders based on a dictionary in form of a CSV file?

I will describe the problem quite verbose, as I have learned that only talking about a specific sub-problem I have identified leads to missed oppurtunities ... So I will put a tl;dr up front: There is ...
3
votes
2answers
72 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 ...
1
vote
3answers
107 views

Is it possible to split file and append the pieces with same extension in one liner?

I did it in two commands --- one for splitting, and one for moving. I can't seem to find my way around it such as to have it all done with one line. What I did was: split.exe --bytes=2300k -d ...
2
votes
1answer
52 views

How to mv and adopt target directory permissions

How do I move a file such that the file adopts the target directory permissions? Surely this is an incredibly common scenario.... any help appreciated.
1
vote
2answers
89 views

Copying and renaming files to a single directory by a single shell script

I have multiple files with an example of how they look like shown below. -rw-r--r-- 1 my_user users 12 Dec 13 09:56 Example_30_001_20130913175000.DAT -rw-r--r-- 1 my_user ...
0
votes
2answers
423 views

Rename file in Mac OS Terminal using Regex

Hundreds of images need to be renamed with a terminal command using regex on MacOS 10.9 Mavericks. The files are named this way: 0045AW489R3T(IPCAM)_0_20131124101245_931.jpg ...
4
votes
3answers
308 views

What is the most efficient way to move a large number of files that reside in a single directory?

CentOS 5.x I apologize if this is a repeat question. I've seen a lot of similar questions (regarding deleting files) but not exactly the same scenario. I have a directory containing hundreds of ...
3
votes
3answers
122 views

How to rename multiple files in single command or script in Unix? [duplicate]

I have the below list of files aro_tty-mIF-45875564pmo_opt aro_tty-mIF-45875664pmo_opt aro_tty-mIF-45875964pmo_opt aro_tty-mIF-45875514pmo_opt aro_tty-mIF-45875524pmo_opt that I need to rename to ...
0
votes
2answers
66 views

How to change user name

I somehow changed my prompt (PS1) from [mpatil@localhost ~]$ to bash-4.1$. I also have changed my user mpatil's home directory from /home/mpatil to /home/algo. Now some applications are not working ...
0
votes
1answer
190 views

Rename multiple files removing last characters and renumbering

I have a photo directory with hundreds of files named in the format: 2013-08-02 19.21.27.jpg I wish to keep the first 10 characters (date) and append "-001", etc. being consecutive for each date. ...
1
vote
1answer
94 views

Copying wallpaper images into a single folder

In my ubuntu 12.04 set-up, there are lots of wallpaper images in the directory /usr/share/wallpapers. For example, one might be usr/share/wallpapers/Leafs_Labyrinth/contents/images/1600x1200.jpg ...
3
votes
4answers
111 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 ...
2
votes
1answer
39 views

Linux shell - unexpected error

I'm new to the linux & command world. I have two directories, one called pasta (which contains 3 files) and another one called pasta2 (with nothing inside). I'm trying to move all 3 files from ...
1
vote
1answer
254 views

rename multiple files recursively and remove multiple characters such as ? : or newline from names

I have seen a few similar questions, but nothing that shows how to remove any of a set of special characters from all file names recursively. I want to keep uppercase and lowercase letters, numbers ...
3
votes
3answers
157 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 ...
2
votes
5answers
116 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.
3
votes
2answers
33 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 ...
5
votes
4answers
182 views

Allowing rename but not moving to other directory

Users can upload/delete/rename files via vsftp server and everything works well except they can also move files across directories. Is it possible to allow renaming of files but disallow moving them ...
1
vote
3answers
441 views

Batch file move to directory structure based on filename

I am writing a script to move files into directories based on the filename. Files have yyyyddmm-xxxxxxx.jpg name format. The desired directory structure is in the format 2013/01 Jan/31. I am unable ...
2
votes
2answers
89 views

Is there a --parents option for mv like for cp?

cp has a useful feature --parents that allows a file's directory structure to be copied to another directory: $ cp -v --parents source/directory/from target/ ‘source/directory/from’ -> ...
5
votes
2answers
91 views

Can two files in a directory be on different filesystems

I'm implementing atomic writes (FWIW in Python on Linux & FreeBSD), and I'm writing to a temporary file in the same directory with the file I'm planning to write to (in order to ensure that they ...
1
vote
2answers
120 views

mv complains about standard input in a pipeline that filters file name with grep

I'm trying to move several .avi files that have spaces in from a CD to my home folder. I've already know how to get rid of the spaces: find /media/mathscd/ | grep -L -r "*.avi" | for file in *; do ...
1
vote
0answers
52 views

Which Unixes support cross-device filesystem links (in particular for rename)?

Just read the following on the FreeBSD man page for the rename syscall: ... [EXDEV] The link named by to and the file named by from are on different logical devices (file systems). Note that ...