General :: Recursively Rename Files/folders To Make Their Names Windows-friendly?
Jan 29, 2011
I have a bunch of files on a Ubuntu box, which have various characters in their filenames that Windows doesn't accept (mostly ":" and "*", but possibly others).What's the simplest way to get these all renamed and moved to a Windows machine? It's OK to replace these characters with something like "[colon]" and "[asterisk]".
View 1 Replies
ADVERTISEMENT
May 8, 2011
I'm planning to writing a script to rename files recursively.
To be said that I'm using /bin/sh (not /bin/bash) as this is the only shell available on the busybox of the linux router (tomato) I'm using.
Basically I would like to rename files with extension .jpg using as a suffix the filename of another file in the very same directory with extension .avi
The reason for this is because pretty much all the DLNA devices like modern TV playing .avi files will display a thumbnail of the video when browsing the filesystem, however to do so they'll need .jpg image wit hthe same filename of the video in the very same directory.
View 3 Replies
View Related
Sep 9, 2009
I need a either a script or perl script that will allow me to mass rename files, folders, and sub folders. I need to replace special chars in the current file names with underscores. I was able to make this happen in a single directory, but not recursively.
Here is what does it in a single directory.
for file in *
do
mv "$file" $(echo "$file" | sed 's/[^A-Za-z0-9_.]/_/g')
done
View 8 Replies
View Related
Aug 11, 2011
Is there any Linux application for finding the folders with the most number of files? baobab sorts folders by their total size, I'm looking for a tool that lists folders by the total number of files in it.
The reason I'm looking is because copying tens of thousands of small files is excruciatingly slow (much slower than copying a few large files of the same size), so I want to archive or delete those folders with high file counts that that will be slowing down the copying (it won't speed things up now, but it would be faster when I need to move/copy it again in the future).
View 5 Replies
View Related
Sep 11, 2009
I have thousands of files in hundreds of sub-directories that need renaming. The files I need to rename all look as below:
Note the .ogg.mp3.
been_all_around_this_world.ogg.mp3
I want to remove the .ogg from the files, so in this one case it would end up renamed looking like this:
been_all_around_this_world.mp3
View 2 Replies
View Related
Jul 22, 2011
lets say I have a project that have generated lots of xml files. Though all these xml files point to a location with the text name TEXT15. I want to change all the files that containts TEXT15 and change it to TEXT16. This actually works for files in a folder but not recursively in all the entire files....perl -pi -c 's/TEXT15/TEXT16/g' ./* but I have many subfolders and within this more subsub folders....i just want to do this recursively.
View 2 Replies
View Related
Jun 7, 2010
I have an archive directory that needs to be cleaned up once per quarter. The top level (/data/archive/*) directory names change daily, as well as the subdirectories and the filenames (the application names everything according to date). Also, there are two top level directories, bin and incoming, that we can't touch. I want to write a shell script that loops through the 15 or 20 top level directories and deletes all files and subdirectories older than 3 days (skipping the bin and incoming folders). Can someone get me started on a script? I am kinda new to shell scripting.
View 2 Replies
View Related
Aug 23, 2010
I am to rename all the files within a directory (which contains multiple subdirectories) recursively without invalid characters.
I tried the coding posted above.
find . -type f -printf '%p
' | while read file; do
oldfile=$(basename "$file")
newfile=$(echo "$oldfile" | sed 's/[^A-Za-z0-9_.]/_/g')
if [ ! "$newfile" == "$oldfile" ]; then
echo mv "$file" "${file%$oldfile}$newfile"
code....
but I get an error on both of them stating "find: bad option -printf find: [-H | -L] path-list predicate-list"
View 9 Replies
View Related
Nov 29, 2009
My problem is this:I have a number of directories, all containing files of different name lenghts, including letters, numbers and possibly spaces. I want to recursively rename all of these files, so that only the _last_ 5 digits (not counting the extension) remain. In other words: I want to cut off all but the last 5 digits and not touch the extension.
I've tried to read up on tr, rename (perl version), sed, cut etc. and browsed through some threads here, but so far couldn't quite figure out how to do it.
If someone could point me to the right (standard) CLI tools and syntax.
View 2 Replies
View Related
Jan 31, 2010
I need to replace ":" from multiple files names, since I am going to copy those files from a linux partition, which admit the ":" to a FAT32 partition, which does not.
Example:
original name: eg06_ana_21-05-06_09:21:03.JPG
wished name: eg06_ana_21-05-06_09-21-03.JPG
I have googled a lot but I have not been able to adapt the examples given by people to my aim.
It seems that rename command is what I should use, but I have no idea to build the correct pearl expression.
View 3 Replies
View Related
Nov 11, 2010
i recently restarted my computer so i baked up all my files to my external terabite restarted my computer pluged in my 2 drives and formated the wrong one DAMB so i lost every file i ever downloaded DAMB i used photorec to get it all back but all my files have system names eg f12223/f12224 etc but when i load the files to media player the correct name i displayed in the media player so is there a program i can get that will rename all the files on my drive with the names the have in propertys
View 2 Replies
View Related
Feb 11, 2011
I need to change folders to 775 and files to 664 recursively, but this bash does not has find command (?). How can I change them recursively?
View 3 Replies
View Related
Sep 26, 2010
I need to strip the executable flag from all files within a certain directory and sub directories. Right now I'm doing it with a 2 step process
find /dir/ -type f -exec chmod ugo-x {} ;
find /dir/ -type d -exec chmod ugo+rx {} ;
Is it possible to modify the first line so that I can strip exec flag from all non-directory files? Since this needs to be done on a fairly regular basis across a lot of directories and files, I'd prefer not to use a bash script which would slow it down.
View 1 Replies
View Related
Feb 10, 2010
I'm currently trying to make a script to rename all the files with one provided file extension to a second provided file extension. I've achieved this by commanding "sh newext doc txt" with the following which works perfectly:
#!/bin/sh
for f in *$1;
do
mv "$f" "`basename "$f" $1`$2";
done;
However, I'd like to be able to modify what I've written so far, so that I can choose whether to convert file extensions in a subdirectory or not. For example, I could enter "sh newext -r doc txt" and the subdirectory's files would also be affected by my script, or enter "sh newext -n doc txt" which would only affect the directory I'm in.
View 4 Replies
View Related
May 12, 2010
Can't rename, move or delete files or folders that have a foreign character.
Code:
The file or folder /data/down/done/1999 Taraf de Ha-douks does not exist.
Kubuntu Karmic. Fails in konqueror and dolphin.
View 5 Replies
View Related
Oct 20, 2010
I have quite a few sound sample files totaling over 4 gigs in size with around 80 root folders and then around 34 sub folders. i have a total of 13 DVD's in the above format. how do i "change the date" on all files in one go is that possible?
View 3 Replies
View Related
Sep 2, 2010
We're in the process of implementing an offsite backup of all our servers to a remote Linux server. We're using rsync over ssh.What I've found is that characters such as ±, ¶,´ and £ are replaced on the Linux server with underscores.I don't mind if it changes these characters in the filenames of documents, but when it renames a language pack from Espa±ol.clx to Espa_ol.clx, it could cause issues for us further down the line.
What do I need to do differently to make the special characters copy over correctly? For the initial sync which will take place locally, before the machine is moved offsite, I have SAMBA enabled. I am able to copy files from Windows to the Samba share, retaining the original filename, though it looks different in the Linux directory listing, i.e. t̻st becomes ĻstThese files get deleted by rsync when it runs, as it does not match the filenames.
View 1 Replies
View Related
Jun 30, 2011
I have a bunch of photos with varying names. I want to give each photo a random name(*), how do I do that? (*)I'm going to put them on a digital photo-frame that can't shuffle
View 4 Replies
View Related
Feb 7, 2010
I'm about to move a lot of folders from an older computer (sarge/etch) over to a newer with Lenny. But I get problems when I reach folders or files with names that contains nordic letters like øå. I'm using an external drive to move the folders. What is the easiest and best way to do this.
View 1 Replies
View Related
Oct 2, 2009
i want to make a script that change the names of files and folders into small letter because they are all in capital and more than 1000 fileit is impossible to do that with my hand
View 14 Replies
View Related
Jul 25, 2011
How would I rename all files with a leading decimal point recursivley? I some how got all my music files to have a decimal point.I tried the below and got a " sed argument to long".[CODE]find /media/MUSIC -type f -name "*.wma" | xargs -0 sed -i 's/.(.*)/1/'[CODE]
Another question, can i just use -type f with out -name ? I am sure that all the files got the decimal point added as the first character.
View 14 Replies
View Related
Feb 8, 2010
I am hoping someone already has a script or knows of an app that will let me do this fairly easily - I have a fairly large folder structure that goes several levels deep, etc. In many cases there are duplicate file names that are not really different, e.g.,
/home/chris/folder/folder1/doc1.doc
/home/chris/folder/folder2/folder3/doc1.doc
I want to recursively go through /home/chris/folder and move everything to /home/chris/another_location/ without subfolders and renaming duplicates as appropriate, e.g.,
/home/chris/another_location/doc1.doc
/home/chris/another_location/doc1_1.doc
View 1 Replies
View Related
Feb 15, 2011
I want to rename some image file extensions from upper case to lower case but renaming all the images in all directories and subdirectories. the following code works if I am inside the folder but how do I make it work recursively?
Code:
for f in *.JPG; do mv $f `basename $f .JPG`.jpg; done;
View 2 Replies
View Related
May 20, 2011
I am happy to report I successfully setup a cloning station using Ubuntu 10.4 Lucid Lynx and Clonezilla. I learned the hard way you have to restore images to a hard drive of a larger size than the drive the image was ripped from. I had already ripped 6 or more images and have them in the Home_Partimag folder and cannot delete or rename these images. I want to remake these images and rip them from smaller hard drives. Any commands I can use to be able to do this?
View 3 Replies
View Related
Jun 18, 2011
I am trying to hide some folders in Ubuntu Linux which are always hidden in Windows through File/Folder Attributes (attrib -h)
It is not an option for me to rename the folder from let's say "Ancient texts directory" to ".Ancient Texts Directory" because the programs associated with these files and shortcuts will not work in Windows. I would like to make the folder hidden by not renaming the folder. Is that so hard to ask?
Is there really no other way of making a folder or a file hidden in Linux just like in Windows by Applying Attributes? I Don't want to rename it by putting a dot in front of it. Moreover renaming a file by putting a dot in front of the name changes the position the folder appears in the list view. For some people this may be ridiculous, but for me with a few hundred files and folders and subfolders, this organisation is important, aside from the aforementioned reasons.
I need to maintain compatibility between the two operating systems' basic folder structure as i must use both Operating systems.
View 9 Replies
View Related
Apr 24, 2011
I would like to use the command line to compare two directories against each other. I have two folders called music collection that have evolved over the last year on two separate computers. 90% of the two folders are the same, but there are small differences. I would like a solution that will print out all the differences so I can analyze them and choose what I want to do with them, before merging the two folders. for example.I would like some kind of output that shows the differences and where its located.
comparing MusicCollection1 and MusicCollection2
dif1.mp3 located in MC1/folder1 (this one I might want to keep and merge over)
dif2.mp3 located in MC2/folder3 (while this one I might realize does not exist in both folders because I deleted it for a reason)
I've looked at sort, uniq, and even tried scripting my own solution, but haven't come up with an elegant solution thus far. Its important that it is recursive because there are about 15 folders in Music collection and more folders under those 15.
View 3 Replies
View Related
Oct 21, 2010
I am trying to write a bash script that will extract a .cbr (.rar) file, traverse the extracted files in alphabetical order and rename them 001.JPG, 002.JPG, 003.JPG, etc.So far I only have this much to extract it:
Code:
#!/bin/bash
#
[code]....
View 8 Replies
View Related
Sep 17, 2009
I am new to Linux.I have installed dual boot, XP(NTFS) and Enterprise Linux Server on same desktop.Now how can I access windows files & folders from Enterprise Linux Server?
View 4 Replies
View Related
Oct 10, 2010
Any script to categorize folders with similar name into one directory. For example: There are 4 directories named LinuxFedora, LinuxUbuntu, WindowsXP and Windows7. The script should be able to create two folder named Linux and Windows wheree respective directories are moved.
Next example: If there are many folder as below:
DevLys 010
DevLys 010
[code]...
View 1 Replies
View Related
Apr 5, 2011
I have a samba share that was previously hosted by and accessed by Windows operating systems. As a result the filenames of all the files are not very command-line/linux friendly. I need to get a script or app that can go through the samba share recursively and change all file names to lowercase and replace spaces in the names with a ".", "_" or something.
View 9 Replies
View Related