Sign in to follow this  
Followers 0
gcue

file copy *.* skipping some files

12 posts in this topic

#1 ·  Posted (edited)

i am trying to copy from a subdir to a parentdir

FileCopy(@ScriptDir & "\Dir\*.*", @ScriptDir, 1)

it copies all the files over just fine except these:

_psexec.exe

vnc_viewer.exe

uptime.exe

is it possible that it fails once it sees the "_" so it stops copying everything else after that?

what syntax should i use that should guarantee all files are copied over... (none of the files are in use by the way).

thanks

Edited by gcue

Share this post


Link to post
Share on other sites



Hi,

you should go to this way :

-list files in directory (filefindfirstfile)

-try to search in your file when copying with string functions if _ exists (stringinstr;stringregexpreplace)


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

hmmm that seems more work than it should be

Share this post


Link to post
Share on other sites

Have you tried to copy them seperatly? FileCopy(@ScriptDir & "\Dir\_psexec.exe", @ScriptDir, 1) etc. Just to see if it's copying like this. Or try to copy them manualy.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

ya i tried that-worked

weird huh?

so it seems that the *.* isnt working correctly with the filecopy udf? =/

Share this post


Link to post
Share on other sites

hmmm that seems more work than it should be

Not really... Copy&Paste from help... 60 seconds later...

$search = FileFindFirstFile(@scriptdir & "\dir\*.*")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    filecopy(@scriptdir & "\dir\" & $file,@scriptdir)
WEnd

; Close the search handle
FileClose($search)

Share this post


Link to post
Share on other sites

ok guess that will have to do

i still think its weird that the *.* didnt work. =/

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

ok guess that will have to do

i still think its weird that the *.* didnt work. =/

It works just fine. Perhaps those files are running and maybe locked from being read. Maybe their ACL is hosed.

Do a better test. Create a folder Old and New, in "Old" create a new file called _TEST.txt and T_E_S_T.txt.

FileCopy(@ScriptDir & "\Old\*.*", @ScriptDir & "\New")

If they copy okay then there is something going on with your files.

Edited by weaponx

Share this post


Link to post
Share on other sites

Another thing I'd suggest, is you copying those files manually to a new folder named TEST, for example. Create an empty folder called DEST and try to copy FileCopy(@ScriptDir & "\TEST\*.*", @ScriptDir & "\DEST")

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

*original post content deleted*

Now I understand.

I hate it when I go wrong.

Look at its attributes. FileCopy() can't copy files with some specific attributes.

Edited by system24

[center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center]

Share this post


Link to post
Share on other sites

Hope this works.

I think you misread the topic. The code you posted purposefully skips the files he NEEDS to be copied over.

Share this post


Link to post
Share on other sites

Hello.

I create the same structure that you explain (3 exe files whith specific name).

And I create the same script that you present.

The filecopy work fine on my PC.

Maybe the files are locked, or the script haven't the right to copy the files.


Best Regards.Thierry

Share this post


Link to post
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
Sign in to follow this  
Followers 0