Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: 2 questions - Move inc subs + some harder question.  (Read 2460 times)

0 Members and 1 Guest are viewing this topic.

donster

  • Guest
2 questions - Move inc subs + some harder question.
« on: December 28, 2007, 01:54:26 PM »
Question 1 is prob easy for most of u , but i couldn't figure out how ..

1 I got this code.
move "C:\something\something\"* "C:\something2\something2"
Instead of moving only files in the main dir , i want to move everything  ( including subfolders and " files inside the subfolders")
How can you do such thing?

2.
Is it possible to get the total size of your folder ( including subfolders / files) and log it in a txtfile as 1 line ( so only 'like : 400kb)
The thing i tried out now would put a whole list of things in the txtfile , but i only want the totalsize , so i can compare the size as logged in txtfile with the size the batch will find at that moment.

Thankyou ,

ghostdog74



    Specialist

    Thanked: 27
    Re: 2 questions - Move inc subs + some harder question.
    « Reply #1 on: December 29, 2007, 06:39:23 AM »
    here's a vbscript
    Code: [Select]
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    strFolder = "c:\test"
    strDestination = "c:\temp"
    ' Move the whole folder to destination
    objFSO.MoveFolder strFolder,strDestination & "\test"
    ' Get folder size
    WScript.Echo "Folder: " & strFolder & " is " & objFSO.GetFolder(strFolder).Size & " bytes."
    save it as myscript.vbs or anything, and from command prompt:
    c:\> cscript /nologo myscript.vbs

    donster

    • Guest
    Re: 2 questions - Move inc subs + some harder question.
    « Reply #2 on: December 29, 2007, 07:14:18 AM »
    Sorry for perhaps being a little unclear before.
    But instead of moving the whole folder itself , i only want to move all files and subfolders (with files) inside it..

    The map itself should remain writable under the action ( thats why)

    But i REALLY appreciate your time and effort! ,   8)

    I am saying this with a coke in my left hand , and a doughnut in my right :D
    what hand is typing? :D





    ghostdog74



      Specialist

      Thanked: 27
      Re: 2 questions - Move inc subs + some harder question.
      « Reply #3 on: December 29, 2007, 07:26:12 AM »
      then use copy, not move. Since you are drinking coke and eating doghnut, i think I will get some too. So i will leave you to do the code yourself. If you need references, check this out

      donster

      • Guest
      Re: 2 questions - Move inc subs + some harder question.
      « Reply #4 on: December 29, 2007, 10:50:15 AM »
      I think i am not far from it , but still aint there"

      I got this:

      dir "C:\target\folder" /S /B > dirnames.log
      type dirnames.log
      for "%i" in (dirnames.log) do move "%i" "C:\destination"




      The txtfile it creates look like this:
      C:\target\folder\submap1\submap2\
      C:\target\folder\submap1\submap2\file.txt
      C:\target\folder\file.txt


      like you can see the data in the txtfile would be exactly what i wanna move .. i only don't know how to read the txtfile lines and move those.
      I think i aint that far from it .. but can't figure it out . -> That why i hope some1here knows it  ;)







      (i don't know if i could move those maps like in this way , but i should atleast be able to move all files that are included in subdirs
      by just doing : dir "C:\target\folder" *.*  /S /B > dirnames.log ( something like that)