Your technology certification is waiting. Enroll in Cloud Class ®
for /f "usebackq tokens=*" %%F in ("%ListFile%") do (
for %%D in (%SearchFolders%) do (
if exist "%%~D\%%~F" copy "%%~D\%%~F" "%DestDir%"
Open in new window
ls_output = subprocess.Popen(["ls"], stdout=subprocess.PIPE, shell=True)
(out, err) = ls_output.communicate()
for x in out.split("\n"):
if x == "myfile.pdf":
subprocess.call(["copy %s" % x, "C:\Desktop\folder"])
This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.
copy myfile.pdf d:\destdir
for /f "tokens=*" %%A in ('dir /b /s /a-d "c:\somedir\myfile.pdf") do copy "%%~A" "d:\destdir"
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.