I have used the below code to save files in current path , however i want to create folder and save all files as backup in this folder like c:\project\backup
any help please
Path = App.Path
Use FileSystemObject(FSO). You can create directory and files using FileSystemObject. You will be able to delete or copy files using FileSystemObject.
To enable FileSystemObject just goto project reference and check Microsoft Scripting Runtime. For more info about FileSystemObject go to link.
Related
I am trying to move files of various extensions to a folder if the filename contains the folder name.
Simple example: I have several files such as Fox-1.doc, Fox-2.doc, etc. I have a folder named Fox. I'm trying to move the files into the folder Fox if folder name is contained in the filename.
I tried to modify the code in the following post but I was not successful.
Move files into existing folders containing part of the filename
Any pointers is appreciated.
If you are using code for doing this try getting the filename and filter from the .contains() method often found in Strings.
If you are using Linux command line I think this could work
mv *fox* destination_path/
For Powershell I found this thread that could help you:
powershell to move files based on part of file name
All you'd have to do is create the .ps1 with the modified script.
I'm trying to set up a set of folders on a Windows NT server 2008 (yes, I know, old) where a user doesn't have access to see the list of files within the folder, but can read a file if they know the full file path.
So I've set up the following AD permissions:
Permissions on the containing folder ("This folder only"):
Traverse folder / execute file
Read attributes
Read extended attributes
Read permissions
Permissions on the files ("Files only"):
Traverse folder / execute file
List folder / read data
Read attributes
Read extended attributes
Read permissions
... and from windows, everything looks great! I can't see inside the folder, but if I know the full path to a file within, I can type it into an address bar and open the file.
But when I run in Command Prompt:
COPY "FullPathToSameFileAsBefore.txt" "C:\someLocalSpot.txt"
... I get:
Access is denied.
0 file(s) copied.
Any ideas? Is there some special access Command Prompt needs to perform the copy that windows doesn't in order to read the file? Any alternatives that will work instead? I can set any of the permissions that are needed, with the caveat that the user cannot see the list of files within the directory.
EDIT with additional info:
So I tried to perform a copy with VBScript using a FileSystemObject. Same error. But using VBScript to read the file with an ADODB binary stream does work.
So it seems to boil down to "You can read this file, but you can't perform a copy." Which seems weird, since if you can read the file, you can certainly copy it (read it, then write the contents someplace else.)
I lost my folder and now i want to recover my data using command prompt.
So, how can i recover my folder and which command is used ?
Thanks in advance.
Using command prompt you can use the System Restore "rstrui.exe".
You could also follow this guide from Cnet to recover files from Recycle Bin using Command Prompt.
To Recover Files in NTFS:
Click Start, Run and enter %systemdrive%\Recycler. Under this folder
you'll see sub folders with names like:
S-1-5-21-1085031214-854245398-1060284298-1003
One of these is your user's Recycle Bin folder, you'll have to
determine which. Then open a Command Prompt Window and type: Start/Run
and type in: CMD
CD\Recycled\ Next type DIR
Locate the files with the file extension that you wish to recover.
There may be more than one of the same type. These files will all be
DC??.xxx where ?? is a number and xxx is the file extension.
Use the COPY command to copy all of the matching files out. For
example: COPY *.DOC C:\Temp
to copy all DOC files to C:\Temp. Now you can open these files and
find the one(s) that you wanted to retrieve.
Guide: https://www.cnet.com/forums/discussions/recovering-permanently-deleted-files-help-226105/
I have filename.zip file and if double click the file it has to extract the file in the desired location("c:\user\username"). I have tried using the batch file but didnt give me the required result.
#echo on
#set nested=%nested%Z
set _dest=c:\user\username
if NOT EXIST %_dest% md %_dest%
So if i double click on zip file it has to execute batch file to place file in the destination folder path.How can i do that?
If I understand correctly, you simply want to extract a .zip archive to a previously defined directory c:\user\username, when the user clicks that .zip archive.
No, this is not possible.
A .zip file has no default extraction destination. Nor has is a way to execute scripts upon extraction. It is just a container for compressed data. When you click it, your OS runs a program configured to handle .zip files, allowing you to view the contents, extract the contents, etc - but what and how exactly, is up to the user that clicked the file.
What you effectively want to have is an installer. Here are some pointers for options to do that:
Microsoft IExpress
Nullsoft Scriptable Install System (NSIS)
Quasi-installer using 7-zip self-extracting archive
I'm working on a project where I need to sysprep a windows 7 image. I need to create a batch script to delete the existing files and sub folders inside another folder with an unknowable name located within the windows/system32/GroupPolicyUsers folder and then copy the needed user policies back into the windows/system32/GroupPolicyUsers/unkownFolderName folder and finally run gpupdate /force.
There is only a single sub folder in the /windows/system32/GroupPolicyUsers folder, but the name of that folder changes to the SID of the user after sysprep which is why I cannot know the exact name of the folder.
Inside this folder having the unknown name there is one sub folder and one file that needs to be deleted and replaced with my own folder and file.
Is this possible using a batch script?
Thanks in advance for your replies...