Link to home
Start Free TrialLog in
Avatar of uco
uco

asked on

Unix Script

Hi
i want a unix script which looks for files wix%.csv . if files exist it should create
a file list.txt with file names . If no files exist it should create a dummy file  named wix%.csv and create list.txt with the dummy file name
thanks
Avatar of ozo
ozo
Flag of United States of America image

Since you say files plural, does that mean you want to look for the file wix%.csv in different directories?  If so, which?
Or did you mean any file matching wix*.csv in the current working directory?
find / -name "^wix*\.csv" >> list.txt

The creation for the files you have to define where and under what conditions it should create an empty file.
you can
touch wix%.csv
to create a dummy file
If the file already exists, it is not created, so you can just always do it before you start (unless you need to preserve its modification and access times)
But where would you want to create it?
Under / ?
under all directories?
(it probably wouldn't make much sense to create one under /dev)
Avatar of Tintin
Tintin

>If no files exist it should create a dummy file  named wix%.csv and create list.txt with the dummy file name

what should the dummy file name be?
Avatar of uco

ASKER

thanks for the replies
I am looking for multiple files with names wix*.csv in the same directory (dev)
Empty file need to be created if no files exist with the name wix*.csv, empty to be created int he same directory (dev)

the dummy file name should be starting with 'wix'  could have anything after wix , file extension should be csv

thanks
What, exactly is the question you are asking?
ASKER CERTIFIED SOLUTION
Avatar of wilcoxon
wilcoxon
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial