Hi,
Is there any combination of ‘ls’ which will output the full path to the file as well as the file name…
as in
myhost$ls
/the/full/path/to/myfile/file.txt
/jlar
Hi,
Is there any combination of ‘ls’ which will output the full path to the file as well as the file name…
as in
myhost$ls
/the/full/path/to/myfile/file.txt
/jlar
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I’ve tried to find this to and usually end up with the following:
for i in ls -1
; do echo $PWD/$i; done
Replace $PWD with a path you specify if you want to check a remote
directory, and also modify the ‘ls’ part in that case. For example if I
wanted to check /tmp I’d do the following:
for i in ls -1 /tmp
; do echo /tmp/$i; done
Good luck.
eeijlar wrote:
> Hi,
>
> Is there any combination of ‘ls’ which will output the full path to the
> file as well as the file name…
>
> as in
>
> myhost$ls
>
> /the/full/path/to/myfile/file.txt
>
> /jlar
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFJixQ33s42bA80+9kRAoneAJ46k58bccy2kLlT3uhbHZSqaI4cowCfSvCS
iGTgI7WyNbwQrnZN5tcoLbg=
=Fn9D
-----END PGP SIGNATURE-----
very clever… thanks
Might be easier to just use find.
Recursively from current directory
find $PWD
Only the current directory
find $PWD -maxdepth 1
Recursively from current directory and display only files (will still have full path to file), but omits results that’s just a directory
find $PWD -type f
Optionaly you can replace $PWD with an absolute directory.