Unique files in a given directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unique files in a given directory
# 8  
Old 08-06-2011
After using the script above, to move to a new directory with same paths:

Code:
./cdupes.sh directory1 directory2 | parallel 'file={}; fpatha=${file#*./}; fpath=${fpatha%/*}; mkdir -p "./ToDelete/$fpath"; mv "$file" "./ToDelete/$fpatha"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Print number of lines for files in directory, also print number of unique lines

I have a directory of files, I can show the number of lines in each file and order them from lowest to highest with: wc -l *|sort 15263 Image.txt 16401 reference.txt 40459 richtexteditor.txt How can I also print the number of unique lines in each file? 15263 1401 Image.txt 16401... (15 Replies)
Discussion started by: spacegoose
15 Replies

2. Shell Programming and Scripting

Directory containing files,Print names of the files in the directory that are exactly same content.

Given a directory containing say a few thousand files, please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents. func(a_directory_name) output -> {“matches”: , ... ]} e.g. func(“/home/my/files”) where the directory... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies

3. Shell Programming and Scripting

Add unique identifier from file to filetype in directory

I am trying to add a unique identifier to two file extensions .bam and .vcf in a directory located at /home/cmccabe/Desktop/index/R_2016_09_21_14_01_15_user_S5-00580-9-Medexome. The identifier is in $2 of the input file. What the code below is attempting to do is strip off the last portion... (21 Replies)
Discussion started by: cmccabe
21 Replies

4. Shell Programming and Scripting

Extract unique files

In a incoming folder i have list of files like below,i want to pick the unique files to process the job. if same file contain more than one then it should pick latest date modified file to process. drwxrwsrwx 2 n308799 infagrp 256 May 20 17:42 Final_Working drwxrwsrwx 2... (1 Reply)
Discussion started by: katakamvivek
1 Replies

5. Shell Programming and Scripting

Looping through entire directory and count unique values

Hello, I`m a complete newbie to coding, please help with this problem. I have multiple files in a directory, I have to loop through the contents of each file and extract number of unique isoforms in that file. Each file is tab delimited and only the line with the first parent (column 3)... (1 Reply)
Discussion started by: ritakadm
1 Replies

6. UNIX for Dummies Questions & Answers

getting unique lines from 2 files

hi i have used comm -13 <(sort 1.txt) <(sort 2.txt) option to get the unique lines that are present in file 2 but not in file 1. but some how i am getting the entire file 2. i would expect few but not all uncommon lines fro my dat. is there anything wrong with the way i used the command? my... (1 Reply)
Discussion started by: anurupa777
1 Replies

7. Shell Programming and Scripting

Find all images, append unique prefix to name and move to different directory

Hi, I have a directory with Multiple subdirectories and 1000s of pictures (jpg) in each directory. The problem is that each directory has a 001.jpg in them. I want to append a unique name (the directory_name)would be fine. and then move them to one main backup directory once they have been... (1 Reply)
Discussion started by: kmaq7621
1 Replies

8. Shell Programming and Scripting

Unique Directory and Folder Deletion Script

Ok, so I just got charged with the task of deleting some 300 user folders in a FTP server to free up some space. I managed to grep and cut the list of user folders to delete into a list of one user folder per line. Example: bob00 jane01 sue03 In the home folder, there are folders a-z, and... (5 Replies)
Discussion started by: b4sher
5 Replies

9. UNIX for Dummies Questions & Answers

To get unique numbers from two files

here i have two files: file 1 1 2 3 4 5 5 6 7 8 9 file 2 4 5 6 6 8 8 (6 Replies)
Discussion started by: i.scientist
6 Replies

10. UNIX for Dummies Questions & Answers

Directory Inode Number Not Unique

Hi, I know that inode for each file is unique, but is it the for the directory? So far I found different directories has the same inode nubmer when you do ls -i, could some one explain why? Thanks a lot. (9 Replies)
Discussion started by: nj302
9 Replies
Login or Register to Ask a Question
fatsort(1)						      General Commands Manual							fatsort(1)

NAME
FATSort - FAT filesystem sorting utility SYNOPSIS
fatsort [options] device DESCRIPTION
FATsort sorts directory structures of FAT filesystems. Many MP3 hardware players don't sort files automatically but play them in the order they were transmitted to the device. FATSort can help here. OPTIONS
-c This option causes FATSort to ignore the case of filenames (e.g. 'example.mp3' is equal to 'EXAMPLE.MP3'). -f Force sorting even if the device is mounted or if FATSort cannot determine if the device is mounted. -h Shows some help information. -i Prints some file system information of the specified device. -l FATSort will not sort directory structures, but just print the current order. -o type This options specifies how FATSort will sort files and directories. type can be 'd' for directories before files (which is the default), 'f' for files before directories, or 'a' for no differentiation between files and directories. -n Uses natural order to sort directory structures instead of alphanumeric order. For example, an alphanumeric order would be file123.mp3 file21.mp3 file3.mp3 and the corresponding natural order would be file3.mp3 file21.mp3 file123.mp3. -q FATSort will work quietly without printing additional information messages. -r Sorts the directories in reverse order (Z-A). -R Sorts the directories in random order. -v Shows version information only. The following options can be specified multiple times: -d directory Sort directory only -D directory Sort directory and all subdirectories -x directory Don't sort directory -X directory Don't sort directory and all subdirectories -I prefix Ignore filename prefix prefix during sorting. For example, passing option -I "the " tells FATSort to sort 'The Beatles.mp3' like 'Beatles.mp3'. EXAMPLES
Sort FAT filesystem on an USB stick: fatsort /dev/sda1 Sort FAT filesystem in a file: fatsort /home/user/fat16_fs.img Sort directory /dir1 and all subdirectories except /dir1/dirA: fatsort /dev/sda1 -D /dir1 -x /dir1/dirA Ignore prefixes 'a ' and 'the ' during sorting: fatsort /dev/sda1 -I "a " -I "the " AUTHOR
Boris Leidner <fatsort(at)formenos.de> SEE ALSO
mount(8) fsck(8) NOTES
FAT12 is not supported yet. REPORT BUGS
Please report bugs to fatsort(at)formenos.de. Thanks. FATSort 0.9.15 2011 fatsort(1)