I try this:
for file in `ls -1 ../files/file_??_??.dat` ; do echo "$file" ; ln "$file" ; done
And for every file it gives this error:
ln: failed to create hard link ‘./file_01_am.dat’ => ‘../files/file_01_am.dat’: No such file or directory
But on the command line this works fine:
ln fail in the loop (also just written directly on the command line) and not fail on the command line when executed directly?
Just for info, the following command also fails in the same way as the loop above (this one also tries absolute pathnames for good measure):
find /media/files -name "file_??_??.dat" -print0 | xargs -0 -L 1 ln
I really do not want to have to manually hard link every file!
files directory is a mounted
smb file system. What is strange is the
ln command works fine if I issue it directly, just not when done in a loop of any kind.