hi ,
I have complete path
Sample:
/pkgs/Incoming/Completed/abc123_xyz.zip
/pkgs/Incoming/Completed/12_abcxyz.zip
/pkgs/Incoming/Completed/qwabcxyz.zip
i just need , so that i can copy these files to different directory,
abc123_xyz.zip
12_abcxyz.zip
qwabcxyz.zip
$ cat sample
/pkgs/Incoming/Completed/abc123_xyz.zip
/pkgs/Incoming/Completed/12_abcxyz.zip
/pkgs/Incoming/Completed/qwabcxyz.zip
$
$ sed 's/.*\///' sample
abc123_xyz.zip
12_abcxyz.zip
qwabcxyz.zip
$
For copying try:
sed 's/.*\///' sample | while read line; do cp "$line" /different/directory; done
or
command that gives the complete path | sed 's/.*\///' | while read line; do cp "$line" /different/directory; done
i have command that gives the complete path , i need just the files names
I'm still not getting you fully, perhaps this?
find . -type f -exec basename {} \;
or this if you want to pass a file containing all the paths:
while read line; do basename $line; done < paths
Hope i make sense.
I use the below cmd to get the list of files that are modified than <temp> file in the <path> diretory
cmd:find <path> -name '*.zip' -type f -newer <temp> -print
i am getting all the list of files that are new or modified, with abs path, i want to copy all of these files to a different directory.