Jump to content

move subfolder from one directory to the othere one


Recommended Posts

Greeting,

I have questions about the move the folder.

for example

in c:\ has a folder call test, under test has 2 folders call loc1 and loc2, in loc1 has some files and sub folder called loc1sub1, some files and sub folder in locsub1 as well.

I want to move everything under loc1 to loc2, how to do that.

Thanks

usera

before

===========================

c:\test

\loc1

\ file1

\ file2

\ .......

\ loc1sub1

\file3

\file4

.......

\loc1sub1sub1

\file5

.....

\loc2

I am looking for

==============================

c:\test

\loc1

\loc2

\ file1

\ file2

\ .......

\ loc1sub1

\file3

\file4

.......

\loc1sub1sub1

\file5

.....

Link to comment
Share on other sites

  • Moderators

If you're trying to move the entire Loc1 directory into Loc2 (Where Loc1 will now be in Loc2), then all you need is DirMove().

If you only want to move the contents, then you could do:

_FileListToArray($s_path_dir, "*")

For/Next loop

If StringInStr(FileGetAttrib(File), "D") Then ; Check FileGetAttrib() (This will validate if the file is a directory)

DirMove()

Else

FileMove()

Endif

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thanks,

Dirmove() works for me. But if I want to remove everything from my desktop to the another folder then it fail.

for example, I want to move C:\Documents and Settings\MYACCOUNT\Desktop to c:\backups

dirmove("C:\Documents and Settings\MYACCOUNT\Desktop","c:\backups")

it won't work.

Do you know why? is it because the desktop is the system file? And what is the solution if I want to remove everything from my desktop to the another folder?

Thanks

usera

If you're trying to move the entire Loc1 directory into Loc2 (Where Loc1 will now be in Loc2), then all you need is DirMove().

If you only want to move the contents, then you could do:

_FileListToArray($s_path_dir, "*")

For/Next loop

If StringInStr(FileGetAttrib(File), "D") Then ; Check FileGetAttrib() (This will validate if the file is a directory)

DirMove()

Else

FileMove()

Endif

Link to comment
Share on other sites

Yes, Desktop is a system created/managed folder, that is why.

If you are migrating users, MS has a KB article which essentially states, you have to be logged on as a different ADMIN user to do this.

Link to comment
Share on other sites

Thank DaRam,

it that is the case, how can I move the files and folders on the desktop to another folder? I mean use another functions?

Really needs to do that,

Thanks

Yes, Desktop is a system created/managed folder, that is why.

If you are migrating users, MS has a KB article which essentially states, you have to be logged on as a different ADMIN user to do this.

Link to comment
Share on other sites

As I wrote, by logging on as a different User with Admin privileges, Copying (NOT Moving) the folder and then deleting the User.

Thank DaRam,

it that is the case, how can I move the files and folders on the desktop to another folder? I mean use another functions?

Really needs to do that,

Thanks

Link to comment
Share on other sites

Idea is good, but not fit for my request, I do not want to delete the Desktop folder, just move everything from there to another folder, still keep Desktop folder.

Thanks

As I wrote, by logging on as a different User with Admin privileges, Copying (NOT Moving) the folder and then deleting the User.

Link to comment
Share on other sites

filecopy? for each file

Link to comment
Share on other sites

dircopy?

like use a recursive filefind function.. get the files and Dirs and then filecopy a file.. and dircopy a directory

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...