(WinAPI) Ordner und Dateien archivieren



  • Moin,

    ich hab folgendes Problem:

    Ich möchte Dateien und Ordner auf eine andere Stelle verschieben! Sozusagen archivieren! Man soll ein Datum eingeben und alle Dateien und Ordner die vor diesem Datum erstellt wurden sollen von der einen Platte auf die andere!
    Bsp: Verschiebe Daten von 😨 (server1 freigabe) auf E: (server2 freigabe)!

    Kann mir da jemand helfen, so bewandert bin ich nämlich in C++ noch nich! 🙄



  • Ich weiß nicht, ob das mit Standard-C++ geht. Plattformspezifische Funktionen sind für sowas IMHO eh besser. Welche Plattform hast du?



  • Ich programmiere unter Windows 2000 mit Visual C++ 6.0



  • Bitte ins WinAPI Forum!

    MoveFile
    The MoveFile function moves an existing file or a directory, including its children.

    To specify how to move the file, use the MoveFileEx function.

    BOOL MoveFile(
    LPCTSTR lpExistingFileName, // file name
    LPCTSTR lpNewFileName // new file name
    );
    Parameters
    lpExistingFileName
    [in] Pointer to a null-terminated string that names an existing file or directory.
    Windows NT/2000/XP: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the Unicode version of the function and prepend "\?\" to the path. For more information, see File Name Conventions.

    Windows 95/98/Me: This string must not exceed MAX_PATH characters.

    lpNewFileName
    [in] Pointer to a null-terminated string that specifies the new name of a file or directory. The new name must not already exist. A new file may be on a different file system or drive. A new directory must be on the same drive.
    Windows NT/2000/XP: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the Unicode version of the function and prepend "\?\" to the path. For more information, see File Name Conventions.

    Windows 95/98/Me: This string must not exceed MAX_PATH characters.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Remarks
    The MoveFile function will move (rename) either a file or a directory (including its children) either in the same directory or across directories. The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume.

    Windows 2000/XP: The MoveFile function coordinates its operation with the link tracking service, so link sources can be tracked as they are moved.

    Windows 95/98/Me: MoveFileW is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.

    WIN32_FILE_ATTRIBUTE_DATA
    The WIN32_FILE_ATTRIBUTE_DATA structure contains attribute information for a file or directory. The GetFileAttributesEx function uses this structure.

    typedef struct _WIN32_FILE_ATTRIBUTE_DATA{
    DWORD dwFileAttributes;
    FILETIME ftCreationTime;
    FILETIME ftLastAccessTime;
    FILETIME ftLastWriteTime;
    DWORD nFileSizeHigh;
    DWORD nFileSizeLow;
    } WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA;

    GetFileAttributesEx
    The GetFileAttributesEx function retrieves attributes for a specified file or directory.

    BOOL GetFileAttributesEx(
    LPCTSTR lpFileName, // file or directory name
    GET_FILEEX_INFO_LEVELS fInfoLevelId, // attribute class
    LPVOID lpFileInformation // attribute information
    );
    Parameters
    lpFileName
    [in] Pointer to a null-terminated string that specifies a file or directory.
    Windows NT/2000/XP: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the Unicode version of the function and prepend "\?\" to the path. For more information, see File Name Conventions.

    Windows 98/Me: This string must not exceed MAX_PATH characters.

    fInfoLevelId
    [in] Specifies the class of attribute information to retrieve. This parameter can be one of the following values. Value Meaning
    GetFileExInfoStandard The lpFileInformation parameter is a WIN32_FILE_ATTRIBUTE_DATA structure.

    lpFileInformation
    [out] Pointer to a buffer that receives the attribute information. The type of attribute information stored into this buffer is determined by the value of fInfoLevelId.
    Return Values
    If the function succeeds, the return value is a nonzero value.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Remarks
    The GetFileAttributes function retrieves a set of FAT-style attribute information. GetFileAttributesEx can obtain other sets of file or directory attribute information. Currently, GetFileAttributeEx retrieves a set of standard attributes that is a superset of the FAT-style attribute information.

    Windows 98/Me: GetFileAttributesExW is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.



  • Danke dir werde es gleih mal ausprobieren!


Anmelden zum Antworten