![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | VBScript to move file in one folder to many folder HI I want VBscript code that check how many file in spesfic filder and move it between 4 folder for example if the main folder has 12 files, the script will move this 12 file to 4 subfolder and in each folder will be 3 files. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: VBScript to move file in one folder to many folder "M.K" <MK@xxxxxx> wrote Quote: > > I want VBscript code that check how many file in spesfic filder and move it > between 4 folder for example if the main folder has 12 files, the script will > move this 12 file to 4 subfolder and in each folder will be 3 files. That certainly is interesting. What have you tried? |
My System Specs![]() |
| | #3 (permalink) |
| | Re: VBScript to move file in one folder to many folder this what i write ParentFolder = "C:\Users\Test\Desktop" set objShell = CreateObject("Shell.Application") set objFolder = objShell.NameSpace(ParentFolder) objFolder.NewFolder "1" objFolder.NewFolder "2" objFolder.NewFolder "3" objFolder.NewFolder "4" Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.MoveFile "C:\Users\Test\Desktop\test\*.*" , "objFolder.NewFolder "1" "2" "3" "4"" "Larry Serflaten" wrote: Quote: > > "M.K" <MK@xxxxxx> wrote Quote: > > > > I want VBscript code that check how many file in spesfic filder and move it > > between 4 folder for example if the main folder has 12 files, the script will > > move this 12 file to 4 subfolder and in each folder will be 3 files. > > That certainly is interesting. What have you tried? > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: VBScript to move file in one folder to many folder please any help "Larry Serflaten" wrote: Quote: > > "M.K" <MK@xxxxxx> wrote Quote: > > > > I want VBscript code that check how many file in spesfic filder and move it > > between 4 folder for example if the main folder has 12 files, the script will > > move this 12 file to 4 subfolder and in each folder will be 3 files. > > That certainly is interesting. What have you tried? > > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: VBScript to move file in one folder to many folder I suspect that other potential respondents see the same problem with your post as I do: Since it does not appear to be a particularly useful exercise, it could be some homework that you are required to do for your study course. If so then analysing your requirements in more detail will probably get you a lot further. The following questions come to the mind: a) Do the four target folders already exist? b) Will there always be exactly four target folders? c) How should the files in the source folder be distributed if there are 5, 6 or 7 files? d) What if the target folder already has a file of the same name as the one you're trying to move? e) Why do you wish to develop a VB Script solution? A batch file would be considerably simpler - it would be a mix of "md" and "move" commands, with a loop controller thrown in. "M.K" <MK@xxxxxx> wrote in message news:7578FCA5-1404-4646-BA46-4B29BAAA8FE1@xxxxxx Quote: > please any help > > "Larry Serflaten" wrote: > Quote: >> >> "M.K" <MK@xxxxxx> wrote Quote: >> > >> > I want VBscript code that check how many file in spesfic filder and >> > move it >> > between 4 folder for example if the main folder has 12 files, the >> > script will >> > move this 12 file to 4 subfolder and in each folder will be 3 files. >> >> That certainly is interesting. What have you tried? >> >> >> |
My System Specs![]() |
| | #6 (permalink) |
| | Re: VBScript to move file in one folder to many folder Hi, Thnak for your reply, i do this as self learning a) Do the four target folders already exist? Yes, b) Will there always be exactly four target folders? no, some time will be more and some time will be less c) How should the files in the source folder be distributed if there are 5, 6 or 7 files? it divided the number of file / number of folder, but if there is more one file it direct go first folder amd if there is 2 file more one go to first folder and second go to second folder d) What if the target folder already has a file of the same name as the one you're trying to move? overwrite, but i want if it possible the script create new folder in each subfolder with the same name of main folder e) Why do you wish to develop a VB Script solution? A batch file would be considerably simpler - it would be a mix of "md" and "move" commands, with a loop controller thrown in. if it possible to di by both that is better for me because i do this as self learining "Pegasus [MVP]" wrote: Quote: > I suspect that other potential respondents see the same problem with your > post as I do: Since it does not appear to be a particularly useful exercise, > it could be some homework that you are required to do for your study course. > If so then analysing your requirements in more detail will probably get you > a lot further. The following questions come to the mind: > a) Do the four target folders already exist? > b) Will there always be exactly four target folders? > c) How should the files in the source folder be distributed if there are 5, > 6 or 7 files? > d) What if the target folder already has a file of the same name as the one > you're trying to move? > e) Why do you wish to develop a VB Script solution? A batch file would be > considerably simpler - it would be a mix of "md" and "move" commands, with a > loop controller thrown in. > > "M.K" <MK@xxxxxx> wrote in message > news:7578FCA5-1404-4646-BA46-4B29BAAA8FE1@xxxxxx Quote: > > please any help > > > > "Larry Serflaten" wrote: > > Quote: > >> > >> "M.K" <MK@xxxxxx> wrote > >> > > >> > I want VBscript code that check how many file in spesfic filder and > >> > move it > >> > between 4 folder for example if the main folder has 12 files, the > >> > script will > >> > move this 12 file to 4 subfolder and in each folder will be 3 files. > >> > >> > >> That certainly is interesting. What have you tried? > >> > >> > >> > > |
My System Specs![]() |
| | #7 (permalink) |
| | Re: VBScript to move file in one folder to many folder Here is what I asked in my most recent reply: c) How should the files in the source folder be distributed if there are 5, 6 or 7 files? and here is what you answered: Quote: > it divided the number of file / number of folder, but if there is more one > file it direct go first folder amd if there is 2 file more one go to first > folder and second go to second folder files into four folders, five files into five folders etc. This contradicts your initial specification where you said: Quote: > for example if the main folder has 12 files, the script will > move this 12 file to 4 subfolder and in each folder will be 3 files. give you any good suggestions. It would also be helpful if you at least attempted to solve the problem yourself and posted some relevant code. The help file script56.chm (which you can download from the microsoft site) will show you all the relevant methods of the File System Object, complete with numerous examples. "M.K" <MK@xxxxxx> wrote in message news:15969D84-4F48-418C-B9EA-352C7080984A@xxxxxx Quote: > Hi, > > Thnak for your reply, i do this as self learning > > > a) Do the four target folders already exist? > Yes, > > b) Will there always be exactly four target folders? > > no, some time will be more and some time will be less > > c) How should the files in the source folder be distributed if there are > 5, > 6 or 7 files? > > it divided the number of file / number of folder, but if there is more one > file it direct go first folder amd if there is 2 file more one go to first > folder and second go to second folder > > > > d) What if the target folder already has a file of the same name as the > one > you're trying to move? > > > overwrite, but i want if it possible the script create new folder in each > subfolder with the same name of main folder > > e) Why do you wish to develop a VB Script solution? A batch file would be > considerably simpler - it would be a mix of "md" and "move" commands, with > a > loop controller thrown in. > > > if it possible to di by both that is better for me because i do this as > self > learining > > "Pegasus [MVP]" wrote: > Quote: >> I suspect that other potential respondents see the same problem with your >> post as I do: Since it does not appear to be a particularly useful >> exercise, >> it could be some homework that you are required to do for your study >> course. >> If so then analysing your requirements in more detail will probably get >> you >> a lot further. The following questions come to the mind: >> a) Do the four target folders already exist? >> b) Will there always be exactly four target folders? >> c) How should the files in the source folder be distributed if there are >> 5, >> 6 or 7 files? >> d) What if the target folder already has a file of the same name as the >> one >> you're trying to move? >> e) Why do you wish to develop a VB Script solution? A batch file would be >> considerably simpler - it would be a mix of "md" and "move" commands, >> with a >> loop controller thrown in. >> >> "M.K" <MK@xxxxxx> wrote in message >> news:7578FCA5-1404-4646-BA46-4B29BAAA8FE1@xxxxxx Quote: >> > please any help >> > >> > "Larry Serflaten" wrote: >> > >> >> >> >> "M.K" <MK@xxxxxx> wrote >> >> > >> >> > I want VBscript code that check how many file in spesfic filder and >> >> > move it >> >> > between 4 folder for example if the main folder has 12 files, the >> >> > script will >> >> > move this 12 file to 4 subfolder and in each folder will be 3 files. >> >> >> >> >> >> That certainly is interesting. What have you tried? >> >> >> >> >> >> >> >> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Cannot Rename or Move a File or Folder in Vista Fix | Tutorials | |||
| I want to move my Offline File Folder | Vista file management | |||
| Move file to folder depending on last two characters of filename | VB Script | |||
| Create New folder, move file, delete file. Explorer Freeze | General Discussion | |||
| Cut & Paste, Move and Rename folder or file in the network | Vista networking & sharing | |||