Guest User

Untitled

a guest
Oct 22nd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. # Loop through all files in folder and append a random string to end of filename
  2. for file in *.*
  3. do
  4. name=${file%.*}
  5. ext=${file##*.}
  6. random=$(LC_CTYPE=C tr -cd 'a-zA-Z0-9' < /dev/urandom | head -c 10)
  7. mv "$file" "${name}_${random}.${ext}"
  8. done
  9.  
  10. # Loop through and transform spaces to underscores
  11. for file in *.*
  12. do
  13. mv -- "$file" "${file// /_}"
  14. done
  15.  
  16. # Create a csv of all the filenames in a directory
  17. "ls" > files.csv
Add Comment
Please, Sign In to add comment