VBS to Delete the folders and files [duplicate] - vbscript

i would like to know if there is a vb script which will move files from a specific location and there subfolders to another location based on their modified date and to keep the original directory structure in the new location.
The results to be saved in a .txt file.
thx in advance.

This former question here on SO
VBScript - copy files modified in last 24 hours
is a sample from which you can start from. If you have any difficulties to adapt it to your needs, come back and ask again.

Related

How to automate copying bulk pdf files from one Share point folder to another in Windows

I wonder if someone has ideas to my case.
I have a list of >200 pdf file names of documents that are saved in a share point folder and I need to copy them to another share point folder. I have looked at video clips of how to use Power Automate to copy/move files, which is very good when the file data type is used as the criteria for selecting the files. However, my list is in word and want to find a way of reading the file names, search them in the source folder and copy to the destination folder.
Any ideas?
You may consider to share the link to the 2nd SharePoint folder inside the 1st SharePoint folder to avoid copying at all?
That been said, you can load your word file into a list in Power Automate and then loop through the list (assuming your word doc has the complete path & filename line by line)
Some references:
https://learn.microsoft.com/en-us/power-automate/desktop-flows/how-to/extract-text-word-document
https://learn.microsoft.com/en-us/power-automate/desktop-flows/use-loops
The rest should be as in the video clips.

How can I mirror deleted duplicates from a source into a destination?

Here's the scenario: We have a computer running Windows 10 which has a directory that's backed up nightly. The backups are done with a batch file utilizing Robocopy and scheduled via Windows. The parameters are as such that the backup will always add any new files or existing file edits into the destination, but it will never delete files from the destination that have been deleted in the source. It essentially archives all files which are in the source directory at the end of each day.
Here's the tricky part. The source directory is very large, and occasionally someone finds a duplicate file (or several duplicates of a file) in it. When that happens, we need to delete all but one copy of the file, and then we need to access the backup directory manually, locate the file there, and do the same. This is tedious and time-consuming as it's not rare for someone to notice an entire subdirectory full of files that exist 5+ times each.
What we're looking for is a way to scan the source directory and all subdirectories inside for duplicate files and remove all but one copy of them, and then a way to reflect that into the destination. I've assumed that we will not be able to use Robocopy to reflect the changes in the destination due to the nature of the backup script it's running, but we do have the ability to run any third-party software on the destination directory as well, essentially running an action in both directories to clean each of them of duplicate files.
On that note, I'm not against using third-party tools to make this cleaner or more efficient, I'm just not aware of any.
There is one way to solve this problem I was also suffering from this problem. but I found that how to use "BATCH" file
There are mainly 2 command
X_COPY
ROBO_COPY
According to your need here, (1)x_copy will be helpfull
xcopywill backup your specific file or folder even if you changed some megabytes data, it will copy the new data and will not be replaced on previous data it will make new copy.
HOW TO DO
Open NotePad and type
xcopy "source file" "destination" /y/e/d/c/f/h/i/z/j
And then save your notepad as ".bat" file
for more requirement use below url
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy

looking for script to delete files in folder. IF ALL FILES ARE OVER A YEAR OLD - but ALL Have to be that old

Looking to delete the folder - IF all files inside that folder are over a year old.
If even 1 file isn't, I need to leave the ENTIRE folder untouched. Very specific, I know.
I should add I have a good amount of folders to complete this on.

Change ItemType from file to directory

to clean up my hard disk I use a Powershell script that automatically copies video files from one folder to a different hard disk and deletes them from the old folder.
Now I installed a new hard disk and wanted to use it to save the files. I changed the paths in the script, but unfortunately forgot to create the destination folder on the new hard disk. The files should be copied to the folder Y:\Moved. However, since this did not exist, the script created a file called "Moved".
Is it possible to convert this file so that Windows recognizes it as a folder? So to change the ItemType from "file" to "directory"?
Best regards,
Florian
No, changing a file to a folder is not possible. Rename the file you created, create the folder, then move the renamed file to the folder.
I made a mistake in thinking. I assumed that a single file was created from all files (just like a folder). Of course, this is not the case. The Moved file was overwritten for each video. So the file only holds the last video. Thanks for your answers anyway.

How do I get batch to recognise a folder with a . in as a folder?

I have a batch file which needs to rename a folder from Profile.Win7 to Profile.Win7.%currentdate%.
Right now I'm just using the command
move /y %userprofileaddress%\Profile.Win7 %userprofileaddress%\%backupfolder%
which doesn't throw an error (as far as I can see) but just doesn't do anything.
The folder isn't in use, so any ideas?
Edit: It works now... I wasn't running as admin. facepalm
I think that it is easier to obtain answers if you directly describe the corresponding processing and results of the batch file in the question.
Both works well and not work examples. And if there are error messages etc.
According to the contents of the current question, it seems that it renames the folder itself rather than moving or copying the files in the folder.
In that case, if there is a program using the corresponding folder and files and folders in it, you should not be able to rename.
Please check whether such a situation has occurred.

Resources