Ubuntu :: Cli Comparing File Names Recursively?
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
ADVERTISEMENT
Sep 17, 2009
Im trying to compare two files and I only want to display the user names that are in the first file and not the second.
So I have one file named final.txt (which contains every user name and only the user names in a list no other information)
Then I have another file Over1.txt (which only contains certain users that have different permissions This file is also setup differently with the user name and some information about the user after the user name.
I need a way to compare final.txt to over1.txt so that I will only display the names that are in final.txt but not Over1.txt
Ive tried using diff and comm but just cant seem to get it two work correctly. Im not sure if im missing a option or what.
View 5 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
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
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
Jun 9, 2009
I have been messing with diff and grep for 2 days now without result
I am trying to match a file consisting of words to many separate other wordfiles in a specific directory. one by one.
What i want the script to do is to report how many matching words my main file has with every file in the directory, each in turn
setup:
Each of em are plain text files with 1 word per line
Output should be something like:
SCRIPT REPORT:
View 8 Replies
View Related
Jul 26, 2011
I'm trying to write a script that takes two arguments, the first argument is a number, and the second argument is a filename. The shell script should indicate if the file's size is BIGGER or SMALLER the number provided. this is what i have sofar, am i on the write track, i'm hoping its just a problem with my if command
if [ $1 -h $2 ]
then
echo "$1 is bigger than $2"
else
[code]....
View 2 Replies
View Related
Mar 29, 2011
I want to compare zone file counting and same name, not records etc of master and slave dns server so that i sure both server contains same copy of the files at a time. Any utility to compare such files in linux?
View 5 Replies
View Related
Oct 11, 2010
I need a script which can format the below text file which contains comments
Code:
Code:
Output should be:
Code:
Code:
Script should compare the column name and paste the output in above said manner.
View 13 Replies
View Related
Jun 14, 2011
I have just been bothered by a fairly small issue for some time now. I am trying to search (using find -name) for some .jpg files recursively. This is a Redhat environment with bash.
I get this job done though I need to copy ALL of them and put them in a separate folder BUT I also need to keep the order intact after copying.
For e.g - If I get a JPG file under /home/usr/new/1/ then the destination also needs to be /test/old/new/1/.
At the moment, I am simply putting all files under /test/old/ and I can't somehow get the later /new/1/ folder path created under /test/old/
I understand this could well be done using while OR if else loop, though if someone can just guide me with a hint, I would be really grateful.
I will complete the rest of the steps and was asking here since I am still not comfortable with the shell/bash scripts yet and planning to be really good at it over the next couple of months.
View 1 Replies
View Related
Feb 23, 2011
Im using an if statement in the bin ash shell and it isnt working.
Code: if (( 5000 > $available_blocks )) then echo "WARNING Disk space low, "$pct_used" is used" fi
I don't think its a problem with the if. When i use that code it creates a file with name of the value $available_blocks instead of using the '>' sign for comparing the 2 numbers.
View 6 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 8, 2011
I recently upgraded to Ubuntu 11 and a few days later my ecryptfs filesystem began misbehaving in a weird way. In my home directory, many subdirectory names are duplicated verbatim. Here's an ls -F excerpt:
Desktop/
Desktop/
Documents/
Documents/
Downloads/
Downloads/
I can no longer access files in those directories (if I ls the directory, it appears empty; I can cd to it, but there's nothing inside). Not all of the directories are duplicated/damaged like this, but most are. A few non-directory files are also duplicated in this fashion, so for example:
[Code]...
View 5 Replies
View Related
Aug 5, 2011
I want to set all directories in /example/ to +x without setting any non-directory files to +x, using the -R option of chmod. There must be a way to do this yes?
View 6 Replies
View Related
Oct 18, 2010
I have a Linux machine that shares some files through NFS. The shared directory is:
/foo
I then mounted a shared directory (from a Windows machine) to:
/foo/bar
/foo/bar is mounted successfully onto the Linux machine and everything is there. However any other machine that mounts /foo from the Linux machine everything is correctly there except /foo/bar is empty. Is there anyway to do a "recursive mount" of file shares. Here is the /etc/fstab entry for the Windows share mount of /foo/bar //windows_machine/share /foo/bar cifs username=user,password=pass 0 0 And the /etc/fstab entry on the client machines that mount /foo server:/foo /foo nfs rw 0 0
View 1 Replies
View Related
Aug 31, 2011
I'm using bash under Ubuntu.Currently this works well for the current directory:catdoc *.doc | grep "specificword" But I have lots of subdirectories with .doc files.How can I search for, let's say, "specificword" recursively?
View 2 Replies
View Related
May 22, 2010
I am looking for an application that will read the file names in a folder and generate a comma delimited file. I want then to import the comma delimited file contests to a spread sheet such as open office.I hava a number of PDF files generated from a scanner, each file with its own scaner generated file name. I want to put these into a data base so I can add the title and other reference information to provide a data base.
View 7 Replies
View Related
May 11, 2011
I am supposed to take some small files, and print them to a specific printer, such that the small files are concatenated into one file. The file name has to be included in the file that gets printed.
Should I be looking to concatenate the files into one file with the file names included, and then print them?
something like: -printfunction -printername < file*
View 7 Replies
View Related
Nov 16, 2010
In case that NFS client of fedora is set to cache nfs file handle, where is the cache stored such as /var/lib/nfs?If it's stored in memory instead of directory tree, what command can I know the combination of file names and file handles with?OS in my test environment: Fedora Core 6
View 2 Replies
View Related
Jul 8, 2011
I have the following content on the source directory:
source/foo.txt
source/bar/another_file.txt
source/bar2/and_another.txt
I want copy those files to a destination directory which, after copy, shall look like this:
destination/foo.txt
destination/another_file.txt
destination/and_another.txt
How can I do this? It seems that "cp" lacks such an option
View 1 Replies
View Related
Nov 4, 2010
I've found myself in the situation where I need to create a menu in gnome/kde for a directory structure full of documents.The directory structure looks like this:
Code:
DOCS/
.. REFERENCES/
[code]...
View 1 Replies
View Related
Oct 20, 2010
I have a considerable number of files in a subdirectory (some fascinating old military clips from archive.org - search on Big Picture if interested). Anyhow, I am downloading them using Internet Download Manager running in an XP virtual machine in VMWare on my Ubuntu 10.04 PC (due to the queuing, restart and speed capabilities of IDM). But I digress - the files are being saved on the host (Samba share) without a file extension. So I have a collection of files with names like
Quote:
The Douglas MacArthur Story
THEY WERE THERE (1960)
I wish to add the extension ".mp4" In Windows this is simply done with the command
Quote:
rename *. *.mp4
This of course does not work in Linux. I have researched the Linux rename command and reviewed a lot of examples. However, I have not found a way to add an extension to a batch of files which are named with no extension to start with. The spaces in the file names also seem to present an issue. At the moment I am renaming them from the Windows VM while they are sitting on the Samba share using the ancient File Manager program from Windows NT which works great on XP. I have experimented with the file rename facility in Gnome Commander however, it does not seem to want to do something so simple.
View 10 Replies
View Related
Nov 8, 2010
I want to find maximum length file in a given directory. It should search recursivley. I want this to be done using ls and simple looping constructs.
View 6 Replies
View Related
Jul 17, 2011
I'm running Ubuntu Server 11.04 (no desktop installed). I'm wondering how I install the necessary support for Japanese text because I have numerous files with Japanese file names and they all show up as garble. I would also like Icecast to broadcast the proper song names with Japanese characters.
View 1 Replies
View Related
Sep 23, 2010
I have bash script for converting files. I have a problem. If file name is "corrupted" then mv command for that file will not work. For example file with "-" in front of the name.
Is there a way to check if in some folder (subfolder) all the files have correct file names or they don't?
If they are all correct -> OK proceed with execution of the script!
If they are not all correct -> NOT OK stop with execution of the script!
View 4 Replies
View Related
Apr 4, 2011
I use the command line frequently to navigate my files so I try not to have spaces in file names. Typically I have used an underscore to connect words but it was recently suggested that I should use a dash. Are there any disadvantages to using an underscore in file names?Should I switch to a dash? My system is running Xubuntu and I almost exclusively use the bash shell.
View 4 Replies
View Related
Feb 25, 2010
I have a csv file of my students' names, but they're listed in the Asian order (last name, first name) and I need to list them in English order (first name, last name).
I know I can use something like awk, but that's usually substituting one thing for another. How can I get it to modify the names in a column in a csv file and swap the order? code...
I would want to switch "Tanaka Hiroto" to read "Hiroto Tanaka". There's about 500-600 names in the list, so doing this using CLI would save a lot of time.
View 4 Replies
View Related
Jan 22, 2010
Anybody know of a way to search only for similar case sensitive files? By which I mean doing a wildcard search across a drive & the only results are like: Abc.txt abc.txt VID_001.avi Vid_001.AVI .. etc.
I've already tried searching the forums & google but the closest I've found is regarding files with increasing numbers (music_001.mp3, music_002.mp3, etc), which doesn't quite fit with my issue, as they would be seen as different files on a case insensitive OS.
View 2 Replies
View Related
Jan 28, 2010
Ubuntu 9.10 is on ext4, XP is on NTFS and the data to be accessed by both OS is on FAT32.
Both systems have Japanese language support enabled, but I am unable to read the Japanese file names from the FAT32 partition when using Ubuntu.
View 2 Replies
View Related
Mar 23, 2010
Atleast I think it's a terminal program. I remember several years ago while using Redhat 7 when working in the terminal it would automatically complete the pathnames and filenames for you. If I was typing in the terminal "cd downloads" but I only typed "cd do" it would automatically complete my command with "cd documents" but if I continued to type "cd dow" it would know that I don't mean the documents folder and it would know the only other folder path with a dow in it is downloads. I'm not sure if my description is 100% accurate but I think you get the idea. Ubuntu doesn't seem to have this by default and I'm curious if I can get it. Is it a terminal program/client I need to use, or just an option? I don't know what it's called so I've had a hard time googling for it!
View 9 Replies
View Related