Wiki source code of Batch upload to Alfresco sites via CIFS
Last modified by Normann P. Nielsen on 2014/12/13 11:32
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | The simplest way to upload multiple files ( = many) is to mount the Alfresco Instance and copy files via CIFS/SMB. | ||
| 2 | |||
| 3 | {{error}}This is a copy method, so datestamps etc. will be dated with the current (copy) date-time, original filedates will not be preserved{{/error}} | ||
| 4 | |||
| 5 | |||
| 6 | {{code}} | ||
| 7 | root@myserver:/data/tmp# mount -t cifs -o username=admin,password=****** //127.0.0.1/alfresco/ /mnt | ||
| 8 | root@myserver:/data/tmp# cd /mnt | ||
| 9 | root@myserver:/mnt# ls -l | ||
| 10 | total 385 | ||
| 11 | -rwxr-xr-x 1 root root 393216 Dec 9 13:36 __CheckInOut.exe | ||
| 12 | drwxr-xr-x 2 root root 0 Dec 8 09:58 Data Dictionary | ||
| 13 | drwxr-xr-x 2 root root 0 Dec 8 09:58 Guest Home | ||
| 14 | drwxr-xr-x 2 root root 0 Dec 8 09:58 Imap Attachments | ||
| 15 | drwxr-xr-x 2 root root 0 Dec 8 09:58 IMAP Home | ||
| 16 | drwxr-xr-x 2 root root 0 Dec 8 09:58 Shared | ||
| 17 | drwxr-xr-x 2 root root 0 Dec 8 21:01 Sites | ||
| 18 | drwxr-xr-x 2 root root 0 Dec 8 20:15 User Homes | ||
| 19 | |||
| 20 | |||
| 21 | root@myserver:/mnt# cd Sites/ | ||
| 22 | |||
| 23 | |||
| 24 | root@myserver:/mnt/Sites# ls -l | ||
| 25 | total 386 | ||
| 26 | -rwxr-xr-x 1 root root 393216 Dec 9 13:36 __CheckInOut.exe | ||
| 27 | drwxr-xr-x 2 root root 0 Dec 8 21:35 familie-billeder | ||
| 28 | drwxr-xr-x 2 root root 0 Dec 8 20:15 public | ||
| 29 | drwxr-xr-x 2 root root 0 Dec 8 10:35 sample-site | ||
| 30 | drwxr-xr-x 2 root root 0 Feb 15 2011 swsdp | ||
| 31 | |||
| 32 | |||
| 33 | root@myserver:/mnt/Sites# cd public/ | ||
| 34 | root@myserver:/mnt/Sites/public# cd documentLibrary/ | ||
| 35 | |||
| 36 | |||
| 37 | root@myserver:/mnt/Sites/public/documentLibrary# cp -R /data/tmp/* . | ||
| 38 | root@myserver:/mnt/Sites/public/documentLibrary | ||
| 39 | {{/code}} | ||
| 40 | |||
| 41 | And **all files and directories** from /data/tmp/* is uploaded to the server and can be seen in the Web-interface. | ||
| 42 | |||
| 43 | Rsync also works, but the ~-~-ignore-times must be used, as the source time and date are not keept in Alfresco, otherwise the rsync will take the full sync every time. | ||
| 44 | |||
| 45 | |||
| 46 | {{code}} | ||
| 47 | root@myserver:/mnt/Sites/public/documentLibrary# rsync -avz --size-only --ignore-times --no-links user@myserver2:/data/ | ||
| 48 | {{/code}} | ||
| 49 | |||
| 50 | or serious deletion: | ||
| 51 | |||
| 52 | |||
| 53 | {{code}} | ||
| 54 | root@myserver:/mnt/Sites/public/documentLibrary# find . -type d -name thumbs -exec rm -rf {} \; | ||
| 55 | {{/code}} |