Тёмный

How to: Automatically move files from one location to another using Task Scheduler 

V!Ru5 @ Bitfragment
Подписаться 183
Просмотров 85 тыс.
50% 1

VBS script:
With CreateObject("Scripting.FileSystemObject")
.MoveFile "\\yourlocation\drive$\source_folder\*.*", "\\yourotherlocation\drive$\target_folder\"
End With
Note: . means all files and all extensions. You can tweak this to suit your needs. For example if you want to move all HTML files, change the parameter to *.html
Created with the RU-vid Video Editor - all right reserved.

Наука

Опубликовано:

 

16 авг 2016

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 116   
@joshhobson2340
@joshhobson2340 2 года назад
Is there any way to make the script only select folders after a certain date ? Current situation is I would like to move all files within a specific folder older than 1 year over to another folder on the same network drive.
@bitfragment
@bitfragment 2 года назад
Hello Josh, Not with the VBScript in this video but you could easily do it with Powershell. Something like this should work: Get-Childitem -Path "d:\source_folder" -Force | ?{$_.LastWriteTime -lt (Get-Date).AddDays(-365)} | Move-Item -Destination "e:\destination_folder" -Force This can be saved as a .ps1 file which in turn can be referenced via a Scheduled Task that can be run once every few months depending on your need. Give it a run and let me know if there are any issues. Cheers!
@joshhobson2340
@joshhobson2340 2 года назад
@@bitfragment that’s great. Thanks for the info and quick response it’s really appreciated.
@bitfragment
@bitfragment 2 года назад
@@joshhobson2340 No worries! Make sure to test it before running it on your main folders :D
@TrojenMonkey
@TrojenMonkey 3 месяца назад
@@bitfragment You can with batch. It's called Robocopy. with /minage, you can decide how old the file should be before it'll be transferred.
@robret13
@robret13 5 лет назад
It's great to see videos that get straight to the point. Good Job
@bitfragment
@bitfragment 5 лет назад
Thanks for watching :)
@royhindole
@royhindole 7 лет назад
Thanks for the upload. Really helpful. Easy to understand and implement
@bitfragment
@bitfragment 7 лет назад
Glad to hear, thank you for stopping by :)
@erichoudek6396
@erichoudek6396 4 года назад
This video is awesome. Thanks for upload. Very simple, very clear, very awesome.
@bitfragment
@bitfragment 4 года назад
Thank you for your kind words and thanks for watching :)
@mikewabrown1052
@mikewabrown1052 2 года назад
really good vid, thank you!
@AlPerreault
@AlPerreault 4 года назад
Thank you for the instructions. Is there a way to move all the subfolders and files in those sub folders as well? ie \\target\folder1\sample.txt
@villa250491
@villa250491 2 года назад
Great video! Thak you! Which programs we may need hace installed to do this moving function? Do you have an script to also rename each file when it is moved?
@SherylBlosel
@SherylBlosel 6 лет назад
Great tutorial. Thank you very much!
@bitfragment
@bitfragment 6 лет назад
Thanks Sheryl.
@SherylBlosel
@SherylBlosel 6 лет назад
Do you happen to have a script that will overwrite the destination folder?
@bitfragment
@bitfragment 6 лет назад
Depends, do you have powershell in your environment?
@SherylBlosel
@SherylBlosel 6 лет назад
I don't believe I do.
@bitfragment
@bitfragment 6 лет назад
What operating system are you running? Are you running this script between workstations or between two disks on the same computer?
@TheRohit5678
@TheRohit5678 5 лет назад
Hi Ravencraft, Thanks for your video. Do we put search operation for a specific file and then move that only file. heaps of thanks if you could suggest some way.
@bitfragment
@bitfragment 5 лет назад
Hello Rohit, If you want to search for a specific file and move only that file, you can modify the batch script as follows: With CreateObject("Scripting.FileSystemObject") .MoveFile "\\yourlocation\drive$\source_folder eport.txt", "\\yourotherlocation\drive$\target_folder\" End With note that I've replaced *.* with report.txt in "\\yourlocation\drive$\source_folder eport.txt". You can type anything instead of report.txt depending on what file you want to move. Let me know if you need further help.
@TheRohit5678
@TheRohit5678 5 лет назад
Hi Ravencraft, thanks for your reply.. Can we write a script which could search a specific file in a folder and move that particular file to the destination folder? Heaps of thanks if you could suggest me some way. thanks
@cuisinepratique7761
@cuisinepratique7761 3 года назад
Thank you very much ! I have a source folder of 10000 files inside and I want to synchronise only 10 to 50 files per day in the target folder. Is it possible to do this please ?
@Randomboy2002
@Randomboy2002 7 лет назад
I'm assuming that this will work even if there are multiple files in the source folder? Excellent video by the way
@bitfragment
@bitfragment 7 лет назад
Yes, this will work even if there are multiple files in the folder. Notice this part of the script - \\yourlocation\drive$\source_folder\* .* The * .* at the end basically means all files and all extension types. If you want to move only specific files, for example, text files, you could modify it to something like *.txt I hope this answers your question.
@andrespomes9699
@andrespomes9699 5 лет назад
hi, thanks! it works great! is there any chance to make it works in subdirectories/subnode? i.e., let's say you have folder "A" which has several folders inside of it and each folder contains *jpg files. You want to move all files *jpg located in folder A (and in its subfolders) to a new folder named as "B". Is that possible? thx
@bitfragment
@bitfragment 5 лет назад
Something like this should do the trick: ' Build array of file types arrFileTypes = Split("PDF,XLS,ZIP,vbs,jpg", ",") Const sourceDrive = "C:" Const targetDrive = "P:" ' Make initial call to get subfolders Set objFSO = CreateObject("Scripting.FileSystemObject") ShowSubFolders objFSO.GetFolder("C:\test") ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' Subroutine to enumerate folder, called recursively ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Sub ShowSubFolders(Folder) For Each Subfolder in Folder.SubFolders ' Get a list of the files in the folder Set objFolder = objFSO.GetFolder(Subfolder.Path) Set filesList = objFolder.Files ' Loop each file and see if it is on the D: For Each file In filesList sourceFile = objFolder.Path & "\" & file.Name targetFile = Replace(sourceFile, sourceDrive, targetDrive) ' Loop allowed extension types For Each extType In arrFileTypes ' Extension match AND it is already there If (UCase(Right(sourceFile, 3)) = UCase(extType)) And objFSO.FileExists(targetFile) Then WScript.Echo "The file already exists on the target " & sourceFile ' Extension match and it is NOT already there ElseIf (UCase(Right(sourceFile, 3)) = UCase(extType)) And objFSO.FolderExists(replace(objFolder.Path, sourceDrive, targetDrive)) Then WScript.Echo "I would move the file, it isn't on target " & sourceFile objFSO.MoveFile sourceFile, targetFile End If Next Next ShowSubFolders Subfolder Next End Sub
@DVidinha
@DVidinha 5 лет назад
Ravencraft, what happens if the source folder is empty? Is there additional logic I can add to address scenarios where the source folder is empty?
@bitfragment
@bitfragment 5 лет назад
If the source folder is empty, nothing happens. The script runs but it produces no results, as expected. What additional logic are you looking to add?
@eobardthawne2690
@eobardthawne2690 Год назад
​​@@bitfragment Hello....my source folder is empty ( files come under automatically at random) so when the script runs it shows runtime error file not found the task scheduler will work only if i acknowledge the error...is there a way to bypass this??
@butterz5876
@butterz5876 7 лет назад
What about files with different names? Currently I generate a new file each day with the days date as the file name, and then manually have to paste this into multiple locations. Any ideas?
@bitfragment
@bitfragment 7 лет назад
Hi, the file name doesn't matter, as long as you've set up your script like this: With CreateObject("Scripting.FileSystemObject") .MoveFile "\\yoursource\drive$\source_folder\*.*", "\\yourotherlocation\drive$\target_folder\" End With The * .* before the comma is very important. It means every file/folder that has any name and any extension. If you have implemented this and it doesn't work you might want to check the scheduled task and ensure it is running properly.
@doriscode
@doriscode 2 года назад
Hi, I'm from Indonesian, thank you for the instructions, really helpful, Is there a way to script a file copy based only on the current date? sorry if my english was good enough. 🙂
@lillegaard
@lillegaard 6 лет назад
how to i create a command that automatically moves a file as soon as it is created? e.g. a movie from torrent. when the torrent is done the file appear in my folder. I now want to file to be copied to another folder without starting the batch file manually or wait for a scheduled time. Just copy as soon as it is created (or moved there for that sake).
@bitfragment
@bitfragment 6 лет назад
I haven't got the chance to review your comment yet, however for this kind of behavior I think a powershell script will suit you best. I'll think of something if u still need it.
@mel2000
@mel2000 6 лет назад
Can I assume that .MoveFile can be replaced with .CopyFile if needed?
@bitfragment
@bitfragment 6 лет назад
Never tested it, but I believe you'll have to use FileSystemObject.CopyFile For copying files I suggest using robocopy though. technet.microsoft.com/en-us/library/cc733145(v=ws.11).aspx
@jasminpattnaik9620
@jasminpattnaik9620 3 года назад
Thanks for this code..it worked for me.I have to rename it as the file_todaysdate,what will be the necessary changes I have to make in this code
@buddyle1
@buddyle1 4 года назад
Thanks for your instruction. I need something slightly different than your example. Here is what I want to do: Remove everything on my O drive once a week....regardless if read only and hidden files (or any files condition). These codes allow to delete everything, but not hidden or read only files. If any input to this is highly appreciated.With CreateObject("scripting.FileSystemObject") .Deletefile "O:\Test\*.*" End With With CreateObject("scripting.FileSystemObject") .DeleteFolder "O:\Test\*.*" End With
@wahyuarditya8406
@wahyuarditya8406 3 года назад
Thanks for video. I have a question let say i have 10 folder and i want move it with different times. ex. folder 1 i want move it where file more than 1 year. folder 2 more than 2 years . 3-10 thanks
@yashtiwari756
@yashtiwari756 5 лет назад
Hi thanks for uploading this video. I have to move one day older logs from one path to another path. Is it possible to restrict according to time?
@bitfragment
@bitfragment 5 лет назад
Yep - PowerShell. I can script it for you :) what type of logs? .log or .txt?
@yashtiwari756
@yashtiwari756 5 лет назад
ravencraft .xml
@yashtiwari756
@yashtiwari756 5 лет назад
I want to automate this process through task scheduler. So if it possible , then let me know.
@jaysaherobmnr9575
@jaysaherobmnr9575 Год назад
Hi @bitfragment, Can you please help me? I'm looking for the script that can move first 1000 files to another directories. Thank you in advance.
@adityalandge7830
@adityalandge7830 6 лет назад
So If I have an application which generates one file every hour. Will this job keep moving the files every hour to the destination directory on the Server???
@bitfragment
@bitfragment 6 лет назад
The way it is set up now, no. But you can browse to the scheduled task properties, go to the Triggers tab, and there's a checkbox there that says "Repeat task every X hours". Check it and enter 1 hour. You can also choose the duration, such as 1 day, or indefinitely.
@R2R0_
@R2R0_ 6 лет назад
is it possible to move files with a certain extension and date to another folder using this method?
@bitfragment
@bitfragment 6 лет назад
The script in this video can move files with a certain extension (just change * . * to somethign like *.html), but based on date no. You'll need to rewrite the script. A good example can be found here stackoverflow.com/questions/22664911/vb-script-to-move-files-around-based-on-date-changed
@mergeandsee
@mergeandsee 5 лет назад
Thank you! How do I overwrite files. My situation involves copy files daily that always have the same file name. So I would like to overwrite them everyday. Is this possible?
@bitfragment
@bitfragment 5 лет назад
Not with this script. But I can have something done for you if you still need it :)
@mohammedibrahim4900
@mohammedibrahim4900 5 лет назад
Hello there!!! I would appreciate it greatly if you could show us how to do that too. And also, how do we write the script in a way that it skips some specific files that we'd like to allow to remain on the desktop? Thanks a bunch!!!
@michaozinski6217
@michaozinski6217 5 лет назад
Hi Ravencraft can you please share trick with overwriting?
@JimTheEditor
@JimTheEditor 5 лет назад
@@bitfragment I'd find a script like this very helpful. I collaborate on video editing projects and have a great need for being able to overwrite the files as the script gets run.
@bitfragment
@bitfragment 5 лет назад
Hi all, apologies for not seeing this sooner, I've been hella busy lately. Would you still like to know how this is done?
@RockFordCademce
@RockFordCademce 2 года назад
how do you make it only move one specific file extention? like for example only move .txt files?
@bitfragment
@bitfragment 2 года назад
You replace * .* with *.txt, like this: With CreateObject("Scripting.FileSystemObject") .MoveFile "\\source\drive$\source_folder\*.txt", "\\destination\drive$\target_folder\" End With
@rafaelrosado4566
@rafaelrosado4566 6 лет назад
Thank for the video. I have a scenario, in my source folder has many file with the same name but different ends. Examples files: test.1 test.2 test.3 xxx.1 xxx.2 xxx.3 In my target folder I have a folder with the same file name, for example: - Folder name as “test” - Folder name as “xxx” How I can to create a script to move the file in to the same name folders? Thank you
@bitfragment
@bitfragment 6 лет назад
The script in this video does not have that behavior built in. A powershell script would suit you best - I can create one for you if you still need it.
@rafaelrosado4566
@rafaelrosado4566 6 лет назад
Yes, please!! Thank you
@bitfragment
@bitfragment 6 лет назад
So, all of your files have the same name but different extensions? such as picture.jpeg, picture.png, picture.gif for example? Trying to understand what exactly you are trying to accomplish so I can write the proper script.
@rafaelrosado4566
@rafaelrosado4566 6 лет назад
ravencraft yes, for example: test_1.pdf , test_2.png and folder name is test and other file xxx_1.pdf , xxx_2.png and the folder name is xxx.
@bitfragment
@bitfragment 6 лет назад
$test_source = Test-Path D:\Source $test_destination = Test-Path C:\Destination $test_files = Get-ChildItem "D:\Source\file.*" $x_files = Get-ChildItem "D:\Source\x.*" $destination_test = "C:\Destination\test_files" $destination_x = "C:\Destination\x_files" if ($test_source -and $test_destination -eq $true) { Write-Host "Paths are valid. Proceeding with moving the files..." -ForegroundColor Green if ($test_files -ne $null) { $test_files | Move-Item -Destination $destination_test -Verbose } else { Write-Host "There are no test files in the Source folder. Nothing to move." -ForegroundColor Blue } if ($x_files -ne $null) { $x_files | Move-Item -Destination $destination_x -Verbose } else { Write-Host "There are no X files in the Source folder. Nothing to move." -ForegroundColor Blue } } else { Write-Host "Paths are invalid. Please check Source and Destination folders." -ForegroundColor Red }
@fatemaalnajjar5374
@fatemaalnajjar5374 Год назад
Great video. But the music is very disturbing and unnecessary.
@bitfragment
@bitfragment Год назад
Thanks for the feedback.
@ramyamaradana860
@ramyamaradana860 3 года назад
Hi Thanks for the video. I have a scenario, my source file is in one server and I need to write a VBA script to move the file to another server for which I know the user name and password.so, how can I write a script including username and password in it?
@rajaduraiadaikalam388
@rajaduraiadaikalam388 6 лет назад
Hi Raven. Thanks for the video. By the way, I have a requirement for which I tried with the basic task, but it did not work. Also tried to test it locally, but no go. So, following is my requirement, Source server: 192.168.6.X Target Servers: 192.168.6.Y & 6.Z * Copy the dumps from Source server\E:\ to 6.Y\dumps\ * Once the copy is done, move the dumps from Source server\E:\ to 6.Z\dumps\ Note: All the required folders are shared. Please help me with this regards while this is an urgent requirement to be implemented asap. Thanks in advance!
@rajaduraiadaikalam388
@rajaduraiadaikalam388 6 лет назад
@Raven - I would need an answer/reply asap, please.
@bitfragment
@bitfragment 6 лет назад
Hi Raj, no problem man, thanks for watching. Without going into many technical details and completely changing the approach (there are better ways to accomplish this) I am thinking you should actually set up TWO scheduled tasks: Task 1: Start: Every day at X hours With CreateObject("Scripting.FileSystemObject") .MoveFile "\\192.168.6.X\drive$\source_folder\*.*", "\\192.168.6.Y\drive$\target_folder\" End With You will need to monitor it in order to determine how much time it takes to complete When you got the timings down, you can create a second task that runs soon after the first one completes like so: Task 2: Start: Every day, after Task 1 completes With CreateObject("Scripting.FileSystemObject") .MoveFile "\\192.168.6.Y\drive$\source_folder\*.*", "\\192.168.6.Z\drive$\target_folder\" End With
@rajaduraiadaikalam388
@rajaduraiadaikalam388 6 лет назад
I tried with the following batch script w.r.t Task 1, but did not work. Please check & advice. With CreateObject("Scripting.FileSystemObject") .MoveFile "E:\source_folder\*.bak*", "B:\target_folder\" End With Where E:\ is the local server's drive, .bak is the type of file to be moved & B: is one of the target folder mapped as the network drive in the source server. I would need only the recent files to b moved.
@srinathvulligadla5322
@srinathvulligadla5322 6 лет назад
Hello I am getting error as below Line: 1 Char: 57 Error: Expected statement Code: 800A0400 Source: Microsoft VBScript compilation error My vb code written as With CreateObject("Scripting.FileSystemObject").MoveFile "\\sourcepath\*.*","\\destinationpath" End With Can you please let me know what went wrong in code ?
@bitfragment
@bitfragment 6 лет назад
It errored out at this line: .MoveFile "\\sourcepath\*.*","\\destinationpath", char 57 starts at "\\sourcepath..." Please write it exactly like this, on 3 lines of code: With CreateObject("Scripting.FileSystemObject") .MoveFile "\\yourlocation\drive$\source_folder\*.*", "\\yourotherlocation\drive$\target_folder\" End With
@JewelRocks123
@JewelRocks123 5 лет назад
I am getting "path not found" while running the script, my source folder is in x.x.x.x ip server, Nd destination is on another ip server
@bitfragment
@bitfragment 5 лет назад
Try this instead, more advanced: ' Build array of file types arrFileTypes = Split("PDF,XLS,ZIP,vbs,jpg", ",") Const sourceDrive = "C:" Const targetDrive = "P:" ' Make initial call to get subfolders Set objFSO = CreateObject("Scripting.FileSystemObject") ShowSubFolders objFSO.GetFolder("C:\test") ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' Subroutine to enumerate folder, called recursively ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Sub ShowSubFolders(Folder) For Each Subfolder in Folder.SubFolders ' Get a list of the files in the folder Set objFolder = objFSO.GetFolder(Subfolder.Path) Set filesList = objFolder.Files ' Loop each file and see if it is on the D: For Each file In filesList sourceFile = objFolder.Path & "\" & file.Name targetFile = Replace(sourceFile, sourceDrive, targetDrive) ' Loop allowed extension types For Each extType In arrFileTypes ' Extension match AND it is already there If (UCase(Right(sourceFile, 3)) = UCase(extType)) And objFSO.FileExists(targetFile) Then WScript.Echo "The file already exists on the target " & sourceFile ' Extension match and it is NOT already there ElseIf (UCase(Right(sourceFile, 3)) = UCase(extType)) And objFSO.FolderExists(replace(objFolder.Path, sourceDrive, targetDrive)) Then WScript.Echo "I would move the file, it isn't on target " & sourceFile objFSO.MoveFile sourceFile, targetFile End If Next Next ShowSubFolders Subfolder Next End Sub
@user-rs3yj3oq9n
@user-rs3yj3oq9n 4 месяца назад
is there a possibility to make it to another server?
@PankajKumar-bd1hx
@PankajKumar-bd1hx 6 лет назад
I want to move only particular file from source to destination. E.g. Only move the file which content file name "Test_*". What changes required in the script?
@bitfragment
@bitfragment 6 лет назад
With CreateObject("Scripting.FileSystemObject") .MoveFile "\\yourlocation\drive$\source_folder\filename.extension", "\\yourotherlocation\drive$\target_folder\" End With For example: With CreateObject("Scripting.FileSystemObject") .MoveFile "\\yourlocation\drive$\source_folder\worddoc.docx", "\\yourotherlocation\drive$\target_folder\" End With
@ramadiga5099
@ramadiga5099 6 лет назад
Hi I have files with different names which I have to transfer from one location to other in same computer also in same network drive can you please help me out what command I have to use
@bitfragment
@bitfragment 6 лет назад
Hi, see the description for which command you can use. Basically, * . * (star.star) means every file, every extension. So, when you put a * (star) it covers all file names.
@ramadiga5099
@ramadiga5099 6 лет назад
ravencraft but I want only selected files by name can it is possible
@bitfragment
@bitfragment 6 лет назад
Yes, you can include the file name and the extension in the script like this: With CreateObject("Scripting.FileSystemObject") .MoveFile "\\yourlocation\drive$\source_folder\filename.txt", "\\yourotherlocation\drive$\target_folder\" End With As per above, you can replace the * with your file names and their respective file extensions.
@mkahvhk
@mkahvhk 5 лет назад
Thank you for your video. how can I move the file automatically not for a specific time.
@bitfragment
@bitfragment 5 лет назад
If you want to have a scheduled task doing that it will have to run permanently and trigger when it finds a file/folder in the specific location.
@devilfea
@devilfea 5 лет назад
@@bitfragment hi, i have a similar use case. How do i have the task triggered when it finds a file/folder in the source location?
@KamilaMu
@KamilaMu 7 лет назад
great video can anybody help me out in this scenario as am stuck with this.. my source folder will change based on year/month/week.. so my case is source will be 2017/1/1 the next week scheduler has to pick my source folder as 2017/1/7 means iterating of 7days.. after 31 .. then it should pick 2017/2/7 ..anyidea will be helpful.. thanks
@bitfragment
@bitfragment 7 лет назад
You can create a static root folder. For example Schedules. This folder can contain all those ever-changing folders. This way, no matter what the name of the folders are, they will still be moved to the desired location.
@mohdshezan8411
@mohdshezan8411 4 года назад
Hi Bitfragment , Can you help me to auto move with overwrite from one folder to another folder ? I just created a script and its working fine and the only thing is its not getting overwrite if same file is exist in another folder. here is the script what i wrote : On Error Resume Next With CreateObject("Scripting.FileSystemObject") .MoveFile "D:\Folder1\*.PDF*", "D:\Folder2\" END WITH I want that : If a file with name ABC.PDF is in FolderA so it should be auto moved to Folder B with overwrite if already exist there.
@bitfragment
@bitfragment 4 года назад
Hi Mohd, Unfortunately, the VBScript MoveFile method works only when the target file does not exist. This is very limited and I do not encourage you to use it, this video was more to show how to use something different than what you would do normally, to get the job done. I would encourage you to try powershell instead. Create a powershell script with this command and run it with the scheduled task instead of the VBScript: Move-Item -Path \\10.10.10.10\c$\test\*.* -Destination \\10.20.20.20\c$\test2\ -Force Replace the -Path IP address with your SOURCE server and -Destination with your destination server. Using the -Force switch at the end will overwrite files if they already exist. Hope this helps! Vlad
@Journetta
@Journetta 3 года назад
Or use Synctoy
@mohanravichandran5522
@mohanravichandran5522 7 лет назад
hi, Thanks for uploading. Can we use this script for network shared drive.. Pls assist..
@bitfragment
@bitfragment 7 лет назад
Hi, yes you can. You'll just have to use the shared drive path instead of a folder. Something like this would work: \\SERVERNAME\sharename For example, here's a scenario. I have a server named SERVER01 that has two drives, drive C and drive D. I want to share the D drive and move all files to another network location on SERVER02. To do this, I would follow the below procedure: 1) share the D drive - give it a share name, you can leave it D, but it's usually best to name it after the purpose it will serve. To avoid going into more detail, I will simply use the defaults and share mine with the default name which will be D. Now, I have a network shared drive which can be accessed by this path: \\SERVER01\D 2) implement the script like so: With CreateObject("Scripting.FileSystemObject") .MoveFile "\\SERVER01\D\*.*", "\\SERVER02\target_folder\" End With
@mohanravichandran5522
@mohanravichandran5522 7 лет назад
Hi thank god. Am working at customer place.. But its not working.can you assist..
@bitfragment
@bitfragment 7 лет назад
I have updated my answer with a more in depth description. Have a look.
@mohanravichandran5522
@mohanravichandran5522 7 лет назад
No its not working..
@mohanravichandran5522
@mohanravichandran5522 7 лет назад
With CreateObject("Scripting.FileSystemObject") .MoveFile "\\Cctv\2017\*.*", "\\10.10.10.144\cctv ew directory\" End With
@theSpicyHam
@theSpicyHam 3 года назад
all that girly stuff yet the blackmasta stronger?
@Journetta
@Journetta 3 года назад
how do you copy files?
@bitfragment
@bitfragment 3 года назад
Instead of .MoveFile you declare .CopyFile, like this: With CreateObject("Scripting.FileSystemObject") .CopyFile "\\yourlocation\drive$\source_folder\*.*", "\\yourotherlocation\drive$\target_folder\" End With
@TheMazurski
@TheMazurski 5 лет назад
Thanks for the video! I have a scenario where I have to move text files from one location to another only if they have a certain word inside the text for an example, the word "secret". what would you add to the script to make this happen? is that even possible with task scheduler? Thank you in advance!
@bitfragment
@bitfragment 5 лет назад
It is possible but not with this VBS. We'll have to look into powershell for that.
@TheMazurski
@TheMazurski 5 лет назад
ravencraft Thank you for the response! I Would really like to know the powershell script that gets the job done. Much appreciated!
@bitfragment
@bitfragment 5 лет назад
Hi Chen, so if you are only looking to move text files, you can try using the Select-String function as per below: Get-ChildItem C:\yoursourcelocation\ -Filter *.txt -Recurse | Select-String -List -Pattern "secret" | move -Destination c:\yourdestinationlocation\ Let me know if that works for you.
Далее
Batch Script to Move File
6:37
Просмотров 21 тыс.
Windows Task Scheduler Explained
27:29
Просмотров 55 тыс.
Copy, Move, Delete files with PowerShell
17:01
Просмотров 172 тыс.
Best mobile of all time💥🗿 [Troll Face]
0:24
Просмотров 1,5 млн