Tag Archive for 'dos2unix'

A script to make a folder UNIX-like

Sometimes I have to deal with people who use a tentatively OS that, among other things, doesn’t understand UNIX-like permissions :).

I modified a bash script of Kaz Kylheku (found in bash-doc) which for a given folder recursively changes:

  • the permissions of all its files to 644 (and “dos2unix” them);
  • the permissions of all its subdirectories to 755

You can find it here.

UPDATE (2007-01-11): it doesn’t make sense to run dos2unix against a non text file so I have just uploaded here a “-t” version that processes with dos2unix only some kind of file as in:
if [[ "$file" =~ '[css|html|js|php]$’ ]]; then
dos2unix $file
fi

If you enjoyed this post, make sure you subscribe to my RSS feed!