Home > Software engineering >  How to move the folder
How to move the folder

Time:09-24

Each master, I encouraged for more than two hours, I didn't understand it; I need to D: \ Disk \ C919 file data that I import the folder and contains all the content, leading to the
D: \ Disk, the work of emergency need, still hope the warrior glad
Vba loop statement I will, I succeeded, I have compiled a program copy the required folder to the required position, but I will not move
Note: the file is too big, too slow

CodePudding user response:

Isn't this "moved across partitions", "copy to the target location, and then delete the source location"!
The so-called "copy too slow," you don't know you is how to replicate,


 Name statement: rename a file, directory, or folder, 

Syntax
The Name oldpathname As newpathname

The Name of the statement syntax has the following several parts:

Part of the description
Oldpathname necessary parameters,
String expression, specify an existing file name and location, can contain directories or folders, and drives,
Newpathname necessary parameters,
String expression, specify the new file name and location, can contain directories or folders, and drives,
The specified file name by newpathname cannot exist,


Description
The Name statements to rename the file and move it to a different directory or folder, if necessary, can cross the Name
Drive mobile files, but when newpathname and oldpathname are in the same drive, only renamed
Existing directory or folder, cannot create a new file Name, directory or folder,
Used on an already open file Name, will produce a mistake, must first shut down before the change Name, open the article
, the Name parameter cannot include more character (*) and single character (?) Wild-cards,

CodePudding user response:

Sub testlsy ()
The Name "d: \ 123" As "e: \ 456
"End Sub
Why not ah, prompt the runtime error "75", the path/file access error

CodePudding user response:

I copied with copyfolder, in order to guarantee the speed, I will be in the same drive letter (for example, D: \) under operation, the file size is slow, when I was I, for example, is a different drive, but in the practical work, my operation is under the same drive

CodePudding user response:

Only for file Name statements, you give it a folder, certainly fail!



CodePudding user response:

Sub MoveAFolder ()
Dim fso
The Set of fso=CreateObject (" Scripting. FileSystemObject ")
Fso. MoveFolder "D: \ 123", "E: \ 123
"End Sub
A runtime error, refused permission, why ah, I quick collapse, how all not line, don't really character pass???????

CodePudding user response:

"Refused permission", it is because of one or more of the following reasons:
1. Your account on the folder, file access only to read, at least do not have permission to "delete files or folders"!
2. By moving files or folders, be "open" or use, temporarily unable to delete,
3. "moving target" position, your account does not have "write" permissions,

Temporarily thought of these, you look at yourself, is there any one or more of them,

CodePudding user response:

 Shell "CMD move D/c: \ Disk \ C919 \ *. * D: \ Disk", VB_HIDE 
  •  Tags:  
  • VBA
  • Related