Ubuntu :: How To Recursively Move And Rename Duplicates
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
ADVERTISEMENT
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
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
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
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 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
View Related
May 17, 2011
I have a directory which was downloaded and has a silly name like "-=Directory=-" on my headless (no GUI) linux box and when I try to deal with this directory using "mv" in order to rename it or move it somewhere, it simply does not work. Terminal instead says:
Code:
mv: invalid option -- '='
how I can rename or move it?!
View 6 Replies
View Related
Jul 18, 2011
I feel like this should have come up before, but is there a convenient way of moving something [directory is what I care about] while leaving a symbolic link in its place? Currently the best way I can find is:
Terminal:
-script of 'mv "$1" "$2"; ln -s "$2" "$1"'
-requires typing out the target name, since it tab completion doesn't work on non-existent things.
GUI:
-move
-rename [copy content first]
-link back
-rename link [paste previous content]
The terminal way defeats the point of using the GUI to easily drag and drop things around, and the GUI is rather clumsy when I have to use copy and paste to even make it work. Being able to manually edit a link target would simplify it, but I don't know of a way to do that.
Note that I'm pretty sure I don't want a terminal solution here, because it's stuff which I don't want to type (and sometimes can't.. seriously, I don't want to try to type a star). Example:
#source:
foo/Some Long thing that has ~random~ characters[a#$%] (%^^) that are annoying!/
#target:
bar/Something Short/
View 6 Replies
View Related
Mar 9, 2010
I have a directory: /var/www/html/something/
and it's got tons of files and directories, some containing hidden files.
I want to move all the contents of something including hidden files up to the site root at: /var/www/html/
What is the proper command for this?
View 4 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
Feb 5, 2011
Just built myself an HTPC from scratch and installed Ubuntu 10.10 on it (using XBMC for now). I'm familiar with Linux and have been dabbling with it for many years but in the end my main computer runs OS X.Trying to modify a script I found elsewhere that will auatomagically rename and move downloaded TV shows into a preexisting file hierarchal system. I have an automator function on my Mac that was put together for PLEX but it will obviously not run in Ubuntu.Here's what I've got so far. Remind you I'm not much of a programmer:
Code:
!/bin/bash
cd /home/htpc/Downloads
[code]....
View 9 Replies
View Related
Jun 29, 2010
I recently had data recovered and it was sent back to me on what I think is an NTFS drive. I copied all the files over to a file share I have on a Linux box, that's ext4. Now I have that share mounted on my OSX machine, and I can't move or rename most of the files. However, in a couple cases I was able to rename a folder after the third try. Another time I was able to rename a folder once, but not again. All the permissions are showing up the same on the command-line -- I can't see any differences between the permissions on any of the files/folders. Note that I can create new folders and add files no problem, and then rename and move those all I want.
View 5 Replies
View Related
Sep 19, 2009
I want to search a directory recursively looking for new .rar/ .zip files. When a new file is found I want to extract the contents to another directory. To top things off would like to rename the source file as something like original.rar.extracted.
View 8 Replies
View Related
Apr 20, 2011
ls -al ../public-back
drwxrwxr-x 4 apache apache 4096 Apr 19 03:32 templates
ls -al ../public-back/templates
drwxrwxr-x 2 apache apache 4096 Apr 19 03:33 content
[code]....
How do I move the contents of /public-back/templates recursively with permissions into /public/templates ?
View 2 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
Oct 24, 2010
Although having used Ubuntu for a good couple of years, I'm still a total beginner when it comes to scripting. However, what I need to do should be fairly straightforward:
Importing images from my digital camera, both RAW "originals" and JPG "copies" end up in the same folder. I typically flip through the JPG:s in Image Viewer and remove those that I'm not interested in. Now, this leaves me with the tedious job of going though all the RAW files in the folder manually to get rid of those too! It sure would be wonderful to get Ubuntu to do the work for me...
The script would simply need to go though all the RAW files in a folder one by one, check for a corresponding JPG file - and if there isn't one, remove the RAW file. How could I accomplish that?
View 3 Replies
View Related
Oct 19, 2010
I have tried a combination of the following lines in .bashrc to try and control duplicates in the bash history file:
export HISTCONTROL=ignoreboth
export HISTCONTROL=erasedups
export HISTCONTROL=ignoredups
[code]....
View 5 Replies
View Related
Nov 17, 2010
I've tried using a script to run incremental backups. The idea was to use the update switch to just update the files in the .tar instead of creating new ones. However it seems to have created duplicate files in the tar instead of just updating them (refer to screenshot). Is this normal?
Here is the command in the script;
Code:
tar -uvpf /home/jonny/.BackUps/Updating/Documents.tar /home/jonny/Documents
Is there a way stop this but still have them update to the latest version?
View 1 Replies
View Related
Jan 17, 2011
Open office Calc all the googles i can read all have removing the duplicates from the spreadsheet. I want to do the exact opposite. I want to keep the dupes and remove the others.
View 1 Replies
View Related
Jan 29, 2010
Recently, I'm getting an annoying problem: When I scroll quickly the text smears or duplicates itself -- doesn't happen with all applications. I haven't had this problem until I started to use OpenGL compositing with my NVidia card.
View 3 Replies
View Related
Sep 19, 2010
For Ubuntu 10.04 LTS / Gnome 2.30.2.
I have two applets on my Gnome panel -- NetworkManager Applet 0.8, and Klipper (it works better than Glipper) -- that I want to move.
HOWEVER, right-clicking the panel icons does not enable me to move these applets, as follows:
- NetworkManager Applet 0.8 does not include a Move item in its list of options.
- Klipper displays a long list of Klipper options but no Move option.
How I can move these items to new locations on the Gnome panel?
View 6 Replies
View Related
Apr 16, 2010
I am running KDE 4.4.2 release '241'. I have no clue if that's the latest dev version, but I do know that each day I have to install a 150MB KDE update, so it probably is. Either way it's pretty annoying. The way opensuse handles repositories is different than Ubuntu's, so somehow I ended up creating duplicates too. So basically, I want to remove any duplicates and also stop receiving the daily KDE updates.You can ignore the google repositories. My repositories
[code]...
View 8 Replies
View Related
Jul 1, 2011
I have a text file which is a list of all my contacts. So far i have only found software and commands which remove duplicates but i would like to remove all duplicates AND their original entries too so only contacts which have no duplicates are left.
View 10 Replies
View Related
Mar 11, 2011
I have a large file and want to keep lines which are duplicates, but the test for duplicates is performed only on the first blank-delimited word.
View 6 Replies
View Related
Sep 24, 2009
i am getting duplicate entries in dag rpm repository with different names in different cases !
# yum search fileinfo
php-pecl-Fileinfo.x86_64 : Fileinfo is a PHP extension that wraps the libmagic library
php-pecl-fileinfo.x86_64 : PECL package to get file information through libmagic[code]....
which is the correct rpm to install ?
View 8 Replies
View Related
Sep 28, 2010
When I ping our Microsoft Windows terminal server "cluster" farm, I get ICMP warnings that there are duplicate packets. I am able to rdesktop to the cluster with no problems. We are trying to setup nagios to run on this Ubuntu configuration and nagios is reporting the following error:
"PING WARNING - DUPLICATES! Packet Loss=0%, RTA=.98ms.
FPing reports duplicates as well. Is there a setting in the Arp table that needs to be set differently because the "Cluster" MAC address isn't an actual hardware MAC but a virtual MAC address?
View 2 Replies
View Related
Jul 14, 2011
I found this email in my inbox. From time to time it's showing up here then Evolution starts downloading messages again and duplicates all my inbox. I think.
View 1 Replies
View Related
Jul 30, 2015
I'm having issues setting up rsyslog to receive syslog from another server and only log to one file. I'm receiving the syslog from the remote side, however its putting the entries into more than one log file.
I configured /etc/rsyslog.conf to enable udp, and I have implemented a filter to log only from that IP address, and then stop processing more rules, but it seems to continue on.
I have found that the remote syslog events are using local0 and local1. There are two custom rsyslog config files in /etc/rsyslog.d that handle those two facilities. If I use that same if statement at the beginning of those custom config files, I can get it to work. Seems like a hack though.
Not working:
I put my if statement before the include statement, thinking I could stop it from hitting the custom rules.
Code:
Select all# /etc/rsyslog.conf Configuration file for rsyslog v3.
#
# For more information see
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
#################
#### MODULES ####
#################
$ModLoad imuxsock # provides support for local system logging
$ModLoad imklog # provides kernel logging support (previously done by rklogd)
#$ModLoad immark # provides --MARK-- message capability
[Code] ....
This works:
A custom config file in /etc/rsyslog.d
Code: Select allif $fromhost-ip == '<my ip>' then /var/log/<my directory>/syslog.log
& ~
local0.* /var/log/<a log file for local0>.log
This is on a WD Mycloud device:
Code: Select allLinux WDMyCloud 3.2.26 #1 SMP Tue Jun 17 15:53:22 PDT 2014 wd-2.2-rel armv7l
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.
View 1 Replies
View Related
Feb 7, 2011
I'm trying to use awk to remove rows that are duplicates based on 3 fields, and I want to keep the on that has the higher value in another field. I'm working in C-Shell. For example the below is greped out of a larger data set to use in here as example:
Input (Field separator is a comma:
Code:
4180,-6999,MA,BARNSTABLE,BOURNE,1,1.7,1700,PM,1/26
4180,-6999,MA,BARNSTABLE,BOURNE,1,3.5,2025,PM,1/26
4180,-6999,MA,BARNSTABLE,BOURNE,1,1.0,1511,PM,1/26
4180,-6999,MA,BARNSTABLE,BOURNE,1,5.7,0540,AM,1/27
[Cpde]....
View 1 Replies
View Related