1087 |
1087 |
1088 If recursive operation is set, all intermediate directories will be created, |
1088 If recursive operation is set, all intermediate directories will be created, |
1089 including any directories in the path specified by aNew which do not |
1089 including any directories in the path specified by aNew which do not |
1090 already exist. |
1090 already exist. |
1091 |
1091 |
|
1092 If the source (anOld) is a file and the recursive operation is set, |
|
1093 then all the files with the same name as anOld in the source directory |
|
1094 including those in subdirectories will be copied to the destination. |
|
1095 |
|
1096 For example, the initial directory structure is as follows: |
|
1097 C:\dir1\file.txt |
|
1098 C:\dir1\subdirA\file.txt |
|
1099 C:\dir1\subdirB\file.txt |
|
1100 |
|
1101 @code |
|
1102 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle |
|
1103 fm->Copy(_L("C:\\dir1\\file.txt"), _L("C:\\dir2\\file.txt"), CFileMan::ERecurse); |
|
1104 // OR without specifying the filename in aNew: |
|
1105 fm->Copy(_L("C:\\dir1\\file.txt"), _L("C:\\dir2\\"), CFileMan::ERecurse); |
|
1106 @endcode |
|
1107 |
|
1108 Because of the recursive behaviour, the final directory structure after |
|
1109 either one of the copy operations above will be as follows: |
|
1110 C:\dir1\file.txt |
|
1111 C:\dir1\subdirA\file.txt |
|
1112 C:\dir1\subdirB\file.txt |
|
1113 C:\dir2\file.txt |
|
1114 C:\dir2\subdirA\file.txt |
|
1115 C:\dir2\subdirB\file.txt |
|
1116 |
1092 If recursive operation is not set, only the matching files located in |
1117 If recursive operation is not set, only the matching files located in |
1093 the single directory specified in anOld are copied. |
1118 the single directory specified in anOld are copied. |
1094 No intermediate directories will be created; if any directories in |
1119 No intermediate directories will be created; if any directories in |
1095 the destination path do not exist, no files will be copied, and this function |
1120 the destination path do not exist, no files will be copied, and this function |
1096 will return KErrPathNotFound. |
1121 will return KErrPathNotFound. |
1120 @endcode |
1145 @endcode |
1121 |
1146 |
1122 1.2 If there is no file to operate on i.e. if source directory is empty, the |
1147 1.2 If there is no file to operate on i.e. if source directory is empty, the |
1123 function will do nothing and return error code KErrNotFound. |
1148 function will do nothing and return error code KErrNotFound. |
1124 |
1149 |
1125 2. Files can be copied across drives. |
1150 2. Files can be copied across drives. |
1126 |
1151 |
1127 3. Open files can be copied if they have been opened using |
1152 3. Open files can be copied if they have been opened using |
1128 the EFileShareReadersOnly file share mode. |
1153 the EFileShareReadersOnly file share mode. |
1129 |
1154 |
1130 4. Read-only, hidden and system files can be copied and |
1155 4. Read-only, hidden and system files can be copied and |
1131 the source file's attributes are preserved in the target file. |
1156 the source file's attributes are preserved in the target file. |
1132 |
1157 |
1133 @param anOld Path indicating the file(s) to be copied. |
1158 @param anOld Path indicating the file(s) to be copied. |
1134 Any path components which are not specified here will be |
1159 Any path components which are not specified here will be |
1135 taken from the session path. |
1160 taken from the session path. |
1136 @param aNew Path indicating the directory into which the file(s) are to be copied. |
1161 @param aNew Path indicating the directory into which the file(s) are to be copied. |
1391 the content of the last directory level only. |
1416 the content of the last directory level only. |
1392 - if there is no trailing backslash ("\") character, then the operation behaves |
1417 - if there is no trailing backslash ("\") character, then the operation behaves |
1393 recursively by default and moves both the last directory level and all of its content. |
1418 recursively by default and moves both the last directory level and all of its content. |
1394 Notice that no trailing backslash ("\") implies moving files recursively automatically. |
1419 Notice that no trailing backslash ("\") implies moving files recursively automatically. |
1395 |
1420 |
1396 For example, if the directory level "b" contains the files F1,F2 and F3, then: |
1421 For example, if the directory level "b" contains the files F1, F2 and F3, then: |
1397 @code |
1422 @code |
1398 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle |
1423 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle |
1399 ... |
1424 ... |
1400 fm->Move(_L("C:\\a\\b\\"), _L("C:\\x\\y\\"), CFileMan::ERecurse); |
1425 fm->Move(_L("C:\\a\\b\\"), _L("C:\\x\\y\\"), CFileMan::ERecurse); |
1401 @endcode |
1426 @endcode |
1419 |
1444 |
1420 If there is no trailing backslash character and the switch is not set, i.e. |
1445 If there is no trailing backslash character and the switch is not set, i.e. |
1421 0 is passed as an argument, the operation behaves the same way as by passing |
1446 0 is passed as an argument, the operation behaves the same way as by passing |
1422 CFileMan::ERecurse flag. |
1447 CFileMan::ERecurse flag. |
1423 |
1448 |
1424 for example: |
1449 For example: |
1425 @code |
1450 @code |
1426 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle |
1451 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle |
1427 ... |
1452 ... |
1428 fm->Move(_L("C:\\a\\b"), _L("C:\\x\\y\\"), 0); |
1453 fm->Move(_L("C:\\a\\b"), _L("C:\\x\\y\\"), 0); |
1429 @endcode |
1454 @endcode |
1434 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle |
1459 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle |
1435 ... |
1460 ... |
1436 fm->Move(_L("C:\\a\\b"), _L("C:\\x\\y\\"), CFileMan::ERecurse); |
1461 fm->Move(_L("C:\\a\\b"), _L("C:\\x\\y\\"), CFileMan::ERecurse); |
1437 @endcode |
1462 @endcode |
1438 |
1463 |
|
1464 If the source (anOld) is a file and the recursive operation is set, |
|
1465 then all the files with the same name as anOld in the source directory |
|
1466 including those in subdirectories will be moved to the destination. |
|
1467 |
|
1468 For example, the initial directory structure is as follows: |
|
1469 C:\src\file.txt |
|
1470 C:\src\subdirA\file.txt |
|
1471 C:\src\subdirB\file.txt |
|
1472 |
|
1473 @code |
|
1474 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle |
|
1475 fm->Move(_L("C:\\src\\file.txt"), _L("C:\\dest\\file.txt"), CFileMan::ERecurse); |
|
1476 // OR without specifying the filename in aNew: |
|
1477 fm->Move(_L("C:\\src\\file.txt"), _L("C:\\dest\\"), CFileMan::ERecurse); |
|
1478 @endcode |
|
1479 |
|
1480 Because of the recursive behaviour, the final directory structure after |
|
1481 either one of the move operations above will be as follows: |
|
1482 C:\src\ |
|
1483 C:\src\subdirA\ |
|
1484 C:\src\subdirB\ |
|
1485 C:\dest\file.txt |
|
1486 C:\dest\subdirA\file.txt |
|
1487 C:\dest\subdirB\file.txt |
|
1488 |
1439 Notes: |
1489 Notes: |
1440 |
1490 |
1441 -# Read-only, hidden and system files can be moved and the source file's |
1491 -# Read-only, hidden and system files can be moved and the source file's |
1442 attributes are preserved in the target file, but open files cannot |
1492 attributes are preserved in the target file, but open files cannot |
1443 be moved. Attempting to move an open file will return an error for |
1493 be moved. Attempting to move an open file will return an error for |
1444 that file, as retrieved by CFileBase::GetLastError(). |
1494 that file, as retrieved by CFileBase::GetLastError(). |
1445 |
1495 |
1446 @param anOld Path indicating the files to be moved. May be either a full path, or |
1496 @param anOld Path indicating the directory/files to be moved. May be either a full path, or |
1447 relative to the session path. Note that if you specify a directory level, |
1497 relative to the session path. Note that if you specify a directory level, |
1448 then the behaviour of the move operation is sensitive to the presence |
1498 then the behaviour of the move operation is sensitive to the presence |
1449 (or absence) of a trailing backslash ("\") character. Any path components |
1499 (or absence) of a trailing backslash ("\") character. Any path components |
1450 which are not specified here will be taken from the session path. See the |
1500 which are not specified here will be taken from the session path. See the |
1451 main description for the detailed explanation. |
1501 main description for the detailed explanation. |