Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ampires

macrumors newbie
Original poster
Nov 13, 2010
1
0
I was given a folder with around a thousand files in it to work on from someone on windows. When I open the folder there are no files. I figured out that the windows program named them all beginning with a period, which makes them hidden in mac. I am trying to use a shell script to add a letter at the beginning of all of them so I can see them.

I've been using this code with the directory with the hidden files as cd:
for i in .*; do mv "$i" "x$i"; done;

i'm trying to add an x to the beginning, but its not working.

If anyone has experience with hidden files it would be appreciated
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,425
A sea of green
Remember that the directories "." and ".." match the pattern. You will not be able to rename these.

Personally, I'd use the 'find' command, because it has tests like "is a file", and logical predicates. It would be perfectly capable of execing a 'mv' command.

And you should probably look into why the filenames all start with ".", unless you know for certain it's just a quirk of the programmer. Dotted filenames suggest something unexpected, which might be something like an archival format, a source-code control system, etc.
 

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
I was given a folder with around a thousand files in it to work on from someone on windows. When I open the folder there are no files. I figured out that the windows program named them all beginning with a period, which makes them hidden in mac. I am trying to use a shell script to add a letter at the beginning of all of them so I can see them.

I've been using this code with the directory with the hidden files as cd:
for i in .*; do mv "$i" "x$i"; done;

i'm trying to add an x to the beginning, but its not working.

If anyone has experience with hidden files it would be appreciated

Code:
ls -a
within terminal will show hidden files to see if that is really your problem.

You might also want to look at the man page for find. (EDIT:chown33 beat me to it)

B
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.