Jason_Sutiono
asked on
How to get just the file name from a file path
Hi guys,
I need a little bit of help here with a shell script that I have attached.
At the moment, it is returning $inputfile1 and $inputfile2 as:
/imports/poupload/input/In voiced123. csv
/imports/input/upload/Ship ped123.csv
Is there a way to just get the file names without the path?(i.e Invoiced123.csv and Shipped123.csv)
I require just the filenames for the parameters of my perl script.
Thanks in advance.
Regards,
Jason
I need a little bit of help here with a shell script that I have attached.
At the moment, it is returning $inputfile1 and $inputfile2 as:
/imports/poupload/input/In
/imports/input/upload/Ship
Is there a way to just get the file names without the path?(i.e Invoiced123.csv and Shipped123.csv)
I require just the filenames for the parameters of my perl script.
Thanks in advance.
Regards,
Jason
#!/bin/bash
BASEDIR="/imports/upload";
umask 0002
for file in `find "$BASEDIR/input/" -name "Invoiced*" -printf "%f\n"` ; do
inputfile1=$BASEDIR/input/Invoiced*
inputfile2=$BASEDIR/input/Shipped*
/cus/imports/test.pl $inputfile1 $inputfile2
done
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or
/cus/imports/test.pl ${inputfile1##*/} ${inputfile2##*/}
wmp
/cus/imports/test.pl ${inputfile1##*/} ${inputfile2##*/}
wmp
ASKER