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

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.

Related

Move files to folder in same directory but for 2,000 separate directories

I've searched all over and seen many similar questions but nothing I was able to tweak and make work for my situation.
I have files in a folder like this
C:\music\unknown-folder-name\*.*
And I want to move all of them to
C:\music\unknown-folder-name\disc1
This seems so simple but I can't figure it out. I'm happy to use PowerShell or regular command line or a batch file or whatever works. Thanks for your help.

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

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.

NSIS installer fails to find existing files while compiling

So I have been trying to build an installer for my game with NSIS. For the most part it works fine but just noticed that it seems to be skipping certain files for no reason. Or no reason I can figure out.
At first I was using this line to gather up all the files in the source folder:
File /r "${NSISDIR}\game\source\*.*"
However, I noticed that this didn't get everything. Granted it found all sub-folders and kept the hierarchy correct. There didn't seem to be any rhyme or reason to what it skipped. Then I tried listing all files and directories separately and found out why. Example:
File "${NSISDIR}\OWTD-DE\source\pygame.math.pyd"
This produces the following error:
File: "C:\Program Files (x86)\NSIS\game\source\pygame.math.pyd" -> no files found.
But that file exists, I can see it in the source folder. This was the case for all missing files. At first I thought it may be the two periods in the name, but various files have that naming convention and they are added fine. I cannot figure out how to get it to recognize these files. Any ideas?
${NSISDIR} is a define used to access the UI resources in the Contrib subfolder, you are not supposed to put your files there. Your source files should not be in Program Files, only installed files should be located there. Also, on 64-bit systems there are two Program Files folders and there are some compatibility hacks in Windows related to %ProgramFiles% so putting your source files there is not optimal. Just because you see that file there does not mean it is actually in Program Files, it could be UAC Virtualization/VirtualStore tricking you...
Normally you would keep your .nsi somewhere in the same directory tree as the rest of your files so you can use relative paths but you can also use a define if you really want to:
!define MYSOURCE "c:\foo\bar"
...
Section
File /r "${MYSOURCE}\*.*"
SectionEnd
If it still misses some files I would suggest trying Process Monitor so you can see the low-level details...
Weirdly enough, this process did not work very well on Windows Home 64-Bit but did on Windows Professional 64-Bit. I'm not sure if this an issue with NSIS itself or what, but nothing was different between the two except the OS. And there really isn't much difference between those two operating systems. However, perhaps some configuration differences between the two was the real issue.
While marked solved, I'm not really sure what the actual issue and solution could be.

VBS to Delete the folders and files [duplicate]

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.

Resources