DubiousAlliance
Technical User
Hello all!
Trying to use "ls" or "find" to get the size of the source file in a soft link.
ie.
root@MYSRV# pwd
/BACKUP
root@MYSRV# ls -al FILE*
-rw-r--r-- 1 root system 24277 Nov 02 15:26 FILE2
root@MYSRV#
root@MYSRV# pwd
/backup/prev1
root@MYSRV# ln -s /BACKUP/FILE2 ./FILE1
root@MYSRV# ls -al
total 0
drwxrwx--- 2 root system 256 Nov 02 15:31 .
drwxrwx--- 4 root system 256 Oct 21 20:36 ..
lrwxrwxrwx 1 root system 24 Nov 02 15:31 FILE1 -> /BACKUP/FILE2
How do I get the actual size of FILE2 (24277) as opposed to the link size of (24)?
I've tried something like:
find . -follow -exec ls -al {} \;
but that doesn't seem to actually follow the link, ie:
root@MYSRV# find . -follow -exec ls -al {} \;
total 0
lrwxrwxrwx 1 root system 24 Nov 02 15:31 FILE1 -> /BACKUP/FILE2
lrwxrwxrwx 1 root system 24 Nov 02 15:31 ./FILE1 -> /BACKUP/FILE2
Thanks in advance!
Trying to use "ls" or "find" to get the size of the source file in a soft link.
ie.
root@MYSRV# pwd
/BACKUP
root@MYSRV# ls -al FILE*
-rw-r--r-- 1 root system 24277 Nov 02 15:26 FILE2
root@MYSRV#
root@MYSRV# pwd
/backup/prev1
root@MYSRV# ln -s /BACKUP/FILE2 ./FILE1
root@MYSRV# ls -al
total 0
drwxrwx--- 2 root system 256 Nov 02 15:31 .
drwxrwx--- 4 root system 256 Oct 21 20:36 ..
lrwxrwxrwx 1 root system 24 Nov 02 15:31 FILE1 -> /BACKUP/FILE2
How do I get the actual size of FILE2 (24277) as opposed to the link size of (24)?
I've tried something like:
find . -follow -exec ls -al {} \;
but that doesn't seem to actually follow the link, ie:
root@MYSRV# find . -follow -exec ls -al {} \;
total 0
lrwxrwxrwx 1 root system 24 Nov 02 15:31 FILE1 -> /BACKUP/FILE2
lrwxrwxrwx 1 root system 24 Nov 02 15:31 ./FILE1 -> /BACKUP/FILE2
Thanks in advance!