![]() |
|
[Shell] Search file in subdirectory and create abd copy to another directory - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Shell] Search file in subdirectory and create abd copy to another directory (/showthread.php?tid=5662485) Pages: Pages
1
2
|
Search file in subdirectory and create abd copy to another directory - YUGOBOSS - Jul 5, 2017 Can someone help me with a CMD command to find a specific file in a subdir and if found it copy it to a mkdir folder. Also would be great if it copy folder name it came from. I have something like this now.. but it doesn't work correctly. mkdir %temp%\test dir where /r/s %appdata% *.txt xcopy/S %appdata% *.txt %temp%\test Some advice? WOULD BE GREAT IF THIS CAN BE RUN HIDDEN WITHOUT THE CMD PROMP :) * - Hackoo - Jul 5, 2017 You can do it with a vbscript file like this one ==> https://stackoverflow.com/questions/44826321/start-application-with-vbs-whos-path-is-different-between-users?answertab=active#tab-top * - YUGOBOSS - Jul 5, 2017 That's kinda hard for me to understand how it works, can someone please give a example code? * - Hackoo - Jul 5, 2017 (Jul 5, 2017 04:59 AM)YUGOBOSS Wrote: That's kinda hard for me to understand how it works, can someone please give a example code?So your aim is to find out all *.txt or a specific name text ??? * - YUGOBOSS - Jul 5, 2017 (Jul 5, 2017 05:02 AM)Hackoo Wrote: So your aim is to find out all *.txt or a specific name text ??? Could be any file, *.txt is just a example, but the most important part is the extention name ( .txt or .dll) * - Hackoo - Jul 5, 2017 (Jul 5, 2017 05:03 AM)YUGOBOSS Wrote: Could be any file, *.txt is just a example, but the most important part is the extention name ( .txt or .dll)Here we go 😉 Code @echo off* - YUGOBOSS - Jul 5, 2017 (Jul 5, 2017 05:15 AM)Hackoo Wrote: Here we go 😉 I will try this out soon and let you know! Thanks man!! File is working thanks! Only 1 problem, if there are multiply files with the same name it will only copy one or it will replace everything with the same, how can I prevent it from replacing files with the same name. Like I have 4x test.txt inside the %appdata% It will only copy it once.. Also is there a way to copy the submap name from where it took the file? Something like: subfolder test1\test.txt subfolder test2\test.txt subfolder test3\test.txt Thanks for your help! * - Hackoo - Jul 5, 2017 (Jul 5, 2017 05:49 AM)YUGOBOSS Wrote: File is working thanks!Here we go again ✌ Just give a try and tell me if this what you want or no ? Code @echo off(Jul 5, 2017 03:56 AM)YUGOBOSS Wrote: WOULD BE GREAT IF THIS CAN BE RUN HIDDEN WITHOUT THE CMD PROMP :)If you want to run it in hidden mode means without the cmd prompt, you should save this file as a RunHiddenBatch.vbs and execute it 😉 ✌ 👍 Code Option Explicit* - YUGOBOSS - Jul 6, 2017 (Jul 5, 2017 02:31 PM)Hackoo Wrote: Here we go again ✌ Wow working great man! Thank you so much. One little question left. I see you have made this option: File.WriteLine "set ""Extensions=txt;dll"" " It will detect extensions, can I modify this to reconize name+extensions? Now it will copy ALL dll and txt file, but if I only want test.dll and test.txt how can I do this? Really appreciate your help men! ------------------------------------------------------------------------------------------------------- Would be awesome if it could ZIP the files when copied succesfully, so all will be stored in 1 .zip or .rar file * - Hackoo - Jul 6, 2017 (Jul 6, 2017 01:04 AM)YUGOBOSS Wrote: It will detect extensions, can I modify this to reconize name+extensionsGive a try for this batch file to catch test.txt and test.dll and i let you make a vbsfile for it ! Code @echo off* - YUGOBOSS - Jul 6, 2017 (Jul 6, 2017 05:25 AM)Hackoo Wrote: Give a try for this batch file to catch test.txt and test.dll and i let you make a vbsfile for it ! This one is working great! thank you very much. Only this one is .bat yes? instead of vbs? Would be great if the zip/rar could be possible :D * - Hackoo - Jul 6, 2017 (Jul 6, 2017 06:23 AM)YUGOBOSS Wrote: This one is working great! thank you very much.Did you like to zip this folder with a password protection or not ? So, i will write a function in vbscript that let you choose if you want to protect it with a password or not ! 😉 EDIT : Here we go again with a new vbscript : Function added ==> Function Create_WinRar_Archive to create an archive rar file protected with a password 😉 Search_File_and_Winrar_it.vbs Search_File_and_Winrar_it.vbs (Click to View) Let me guess 😁 Your next question after zip a folder is to upload it via FTP ? Am i right ? 😝 * - YUGOBOSS - Jul 6, 2017 (Jul 6, 2017 06:58 AM)Hackoo Wrote: Did you like to zip this folder with a password protection or not ? Password protection would be great. haha wow that idea about FTP is awesome, is it possible? 😝 Do you have skype maybe we can have a talk there. * - Hackoo - Jul 6, 2017 (Jul 6, 2017 08:16 AM)YUGOBOSS Wrote: Password protection would be great. Check my last edit above 🎉 and tell me how it works on your side this new vbscript ✌ * - YUGOBOSS - Jul 6, 2017 (Jul 6, 2017 08:40 AM)Hackoo Wrote: Check my last edit above 🎉 and tell me how it works on your side this new vbscript ✌ Thanks again for your great help. I have created .vbs file and run it the file copy is working perfectly but it does not pack .rar/.zip the files after. Maybe I'm doing something wrong? Oh wait! it does work but It drops the .rar file in %temp% Password is working aswell! Love you men :D |