Advertisement
metalx1000

Fat Partition file sorting

Jan 27th, 2017
646
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.54 KB | None | 0 0
  1. #!/bin/bash
  2. #vfat file order
  3.  
  4. #create 100 random numbered files of 4 digit length
  5. for i in `seq 1 100`;do touch $(($RANDOM%9000+1001));done
  6.  
  7. #use find and you  will find them to be in a non sequential order
  8. find
  9.  
  10. #this is what we want
  11. find|sort
  12.  
  13. #touch does not work because it's not a timestamp thing, it's the order the files are written to the device
  14. find|sort|while read i;do touch "$i";done
  15.  
  16. #use fatsort
  17. #install fatsort
  18. sudo aptitude install fatsort
  19.  
  20. #unmount the drive then run fatsort on the partition
  21. sudo fatsort /dev/sdX1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement