troubleshooting Question

Shell script to parse and delete files

Avatar of gaurav sharma
gaurav sharma asked on
LinuxShell Scripting
9 Comments1 Solution246 ViewsLast Modified:
Have two dir's Dir_A and Dir_B

===Directory A has the below files


====Text file(list.txt) has something like (name of files in Dir_A)


Shell Script that will delete all of the files in Dir_A except the ones in the list.txt

Parameters to the shell script

Parameter 1: Path to list.txt file with list of file names
Parameter 2: Path to top level directory(Dir_A) where the files exist.

Call to the script : path/to/Dir_A path/to/list.txt

The above script should delete all of the scripts in Dir_A except the ones in the list.txt and

Copy the all the Contents to Dir_B
Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros