iTunes and File Sharing

24 02 2013

Introduction …

Apple offers an application called iTunes to install on a Mac/PC.
This application provides a functionality called File Sharing for supporting the transfer of files between an iOS device and a computer. When I talk about File Sharing I talk about the tab APPS in iTunes and not about music, photos, or other stuff.

20130113-174139.jpg

You should always keep in mind that regular backups of your device are indispensable but there is no way to extract a single file from this backup for restoring it on your device. If you loose a file you must have a copy elsewhere to restore it, or, you must restore your complete device and loose all your data changed after the last backup.

Note

For some other files the data exchange is also supported without the use of iTunes, e.g. the Photo Stream where photos are transferred automatically to iCloud and from there transferred to all other devices using the same Apple ID.

To understand File Sharing we first take a glimpse on the iOS filesystem.
Refer to the image above.

Specific folders are assigned for each app on your device. An app only can work with these folders and not with folders of another app. This is what Apple calls ‘The sandbox mode‘ and it’s designed for security reasons. An iOS app’s interactions with the filesystem are limited mostly to the directories within the app’s sandbox. Because it is in a sandbox an app is generally prohibited from accessing or creating files outside its home directory. One exception from this rule is when an app uses public system interfaces to access things such as the user’s contacts.

This design prohibits direct access from your computer to files on your device, e.g. you cannot copy a PDF which was generated by the app Scanner Pro after scanning a document.
However, a user must have access to some files on his iOS device to further use them on the computer. This functionality is provided by iTunes File Sharing.

How to use File Sharing …

How to install and configure iTunes see

Apple iTunes: How to set up an Apple ID

Connect your iOS device to your computer using the included Dock Connector to USB cable.
Launch iTunes on your computer. Select your iOS device from the Devices section of iTunes.

Click the Apps tab and scroll down to the bottom of the page.

Note

If you do not see the File Sharing section shown in the image below, your iOS device does not have any apps that support File Sharing.

.

Under the File Sharing section, you’ll find a list of apps currently installed on your iOS device that support File Sharing. Select an app to view a list of the files associated with that app on your iOS device.

How to copy files from and to the iOS device …

Drag and drop files onto the Documents list to copy them to the app on your iOS device or…
Click the Add… button, locate the file or files you want to copy from your computer, and click Choose. The selected files will be copied to the app on your iOS device immediately. Select only files that are supported by the iOS device app. Refer to the iOS app’s documentation to determine which file formats are supported.

Avoid data loss …

Be careful …

If you delete an app on your iOS device
you also delete all files associated with it.
That’s a consequence of the above explained iOS file system.

To avoid losing files on your iOS device associated with the app, back up and copy shared files to your computer frequently, and especially prior to deleting the application from your iOS device.

To do this, select the files shown in the Documents section of the specific app and copy them to a local folder on your computer. The folder should be named with the app’s name.
If your device is an iPad, the app, which files you want to save is Apple’s Keynote than put the files in a well-named folder on your computer and name it like

…iOSFileBackups\iPad\Keynote\presentation.key

Note

It depends on the app’s functionalities which way is best to avoid data loss.
Some apps with iCloud support, such as Apple’s iWork suite, save files as a local copy on your device and in iCloud to push them to other devices.
With other apps not supporting iCloud but supporting ‘Send by E-Mail’ you may send a file to your own E-Mail address and use it as a backup.

Syncing …

What is syncing compared to file sharing?

Syncing (with your computer) means that changes to files you made on your iOS device are transferred to your computer’s local hard drive when you connect your device via USB to your computer, open iTunes, select your device and start Syncing.

Which data are synced?

Documents Directory – ApplicationHome/Documents
The Documents directory is the primary location to save user and application related content. This directory and its subdirectories, are backed up when a user does a sync with iTunes. This directory is also the repository for iTunes file sharing content.

Documents Inbox – ApplicationHome/Documents/Inbox
The Documents Inbox is primarily used when an application such as Apple’s Mail app calls an app with a request to open a specific file type.
The file passed to the application (from the Mail Inbox) is stored in the Documents Inbox directory.
The content in the Documents Inbox directory is backed up when a device is synced with iTunes.

tmp – ApplicationHome/tmp
As the name implies, the tmp directory is available for files that are used only while your application is running. The content in the tmp directory is not backed up when a device is synced with iTunes.

Library – ApplicationHome/Library
The Library directory is intended for content that is not user generated. The content in the Library directory is backed up when a device is synced with iTunes, with one exception, there is a Caches directory that is not backed up.

You might think that if you sync you already have a copy of your data on your computer.
That’s true, but not in all cases.

20130114-083709.jpg

Example

Files of the app Discount Spreadsheet (Luminant Software) are updated in the File Sharing section of iTunes every time and immediately after you connect your device via USB.

Files of Apple’s iWork suite on the other hand are possibly not displayed. The reason than is that they never were copied to iTunes. As I figured out data of some apps have to manually transferred to iTunes.

There is no general rule which app presents its data in the File Sharing section of iTunes. If you don’t see any files after selecting an app, open the app on your iOS device and try to find an option (like File Sharing, e.g. app 1Password) or a command (like ‘Copy to iTunes’, e.g. apps of iWork suite) to transfer files to iTunes.

The possible behaviors of apps syncing with iTunes File Sharing sections are

  • automatically
    e.g. Tap Forms, Plain Text, Discount Spreadsheet
  • not automatically, only after manual action like ‘Copy to iTunes’
    e.g. iWork (Numbers, Pages, Keynote)
  • after entering credentials and selecting a command like ‘PC iTunes File Sharing’
    e.g. Safety P+V, Safety Notes
  • on demand after activating this feature in Settings of the app (File Sharing ON)
    e.g. 1Password

Syncing with iCloud …

For Apple’s iWork suite keep in mind that turning off syncing with iCloud stops syncing across all of your other devices and iWork files are only stored locally on your iOS device. You should never set the option ‘Use iCloud’ to OFF (Settings – options for Keynote, Numbers, Pages) if you work on more than one device.

20130114-084255.jpg

If you possibly turn it to ON later you will get a lot of messages regarding different versions of your documents and you have decide for each single document what to do (Keep it from this or that device or both).

20130114-090307.jpg

Summary …

There are apps supporting file sharing, other apps which do not, apps syncing with iCloud or not, apps providing backup functionalities, and others for which iTunes File Sharing is mandatory.

For Apple’s own iWork suite the situation is a bit confusing.
If you use iCloud the documents are synced with iCloud and across all your other devices but not backed up in iTunes. And unfortunately there is no option to copy them to iTunes in total.

Sorry!

You may think that this blog article is a bit confusing with all its If’s and Then’s and Else’s and But’s. But I don’t bare the blame. If there is no consistent concept there is no consistent description.

My personal recommendations …

Turn on Syncing via iCloud

Your benefit:
Data of iCloud capable apps are accessible on all of your devices
and are also available as local copies if you currently don’t have an internet connection.
But keep in mind that if you delete a file on one device it’s immediately deleted across all other devices using the same Apple ID.

Use an additional storage

Your benefit:
There is an extra level of copies of files which can be separately restored whatever happens on iCloud or on your device.
For iWork you may use the available WebDAV connection to a cloud provider (e.g. iDriveSync). If you install the related client application on your computer you will also have access from your computer to those files without using file sharing of iTunes.
Use ‘Copy to WebDAV’ every time you worked on a single document.

Useful links …


Apple How to transfer or sync content to your computer

Apple iOS: About File Sharing

Apple iWork for iOS: About File Sharing

Apple iOS: Syncing with iTunes

Apple iTunes: About iOS backups

iNotes4You iWork and iCloud





ROBOCOPY the iOS-Backup

10 01 2013

You can backup your iOS-Devices on iCloud.
If you additionally use iTunes you may want to transfer the complete iTunes-Backup of your devices to another location.

For Windows Vista/7/8-Computers there is a powerful helper app shipped with Windows that can sync one location with another in one direction (source to destination). It’s called ROBOCOPY.exe.

Robocopy, or ‘Robust File Copy’, is a command-line directory replication command. It has been available as part of the Windows Resource Kit starting with Windows NT 4.0, and was introduced as a standard feature of Windows Vista, Windows 7/8 and Windows Server 2008. The command is robocopy.

Features of ROBOCOPY …

  • Ability to tolerate network interruptions and resume copying. (incomplete files are marked with a date stamp of 1980-01-01 and contain a recovery record so Robocopy knows where to continue from)
  • Ability to skip Junction Points which can cause to fail copying in an infinite loop (/XJ)
  • Ability to copy file data and attributes correctly, and to preserve original timestamps, as well as NTFS ACLs, owner information, and audit information using command line switches. (/COPYALL or /COPY:) Copying folder timestamps is also possible in later versions (/DCOPY:T).
    Access control list (ACL), with respect to a computer file system, is a list of permissions attached to an object. An ACL specifies which users or system processes are granted access to objects, as well as what operations are allowed on given objects
  • Ability to assert the Windows NT ‘backup right’ (/B) so an administrator may copy an entire directory, including files denied readability to the administrator.
  • Persistence by default, with a programmable number of automatic retries if a file cannot be opened.
  • A ‘mirror’ mode, which keeps trees in sync by optionally deleting files out of the destination that are no longer present in the source.
  • Ability to skip files that already appear in the destination folder with identical size and timestamp.
  • A continuously updated command-line progress indicator.
  • Ability to copy file and folder names exceeding 256 characters on to a theoretical limit of 32,000 characters without errors.
  • Return code on program termination for batch file usage.

The BATCH-File …

Use this BATCH-File with ROBOCOPY-Commands to do the job.

robocopy "c:\Users\%1\AppData\Local\Apple" "%2:\ios-backup" /mir /purge /tee /log+:c:\Users\%1\AppData\Local\Apple\ROBOCOPY-IOS-DEVICE.log /np
robocopy "c:\Users\%1\AppData\Roaming\Apple Computer" "%2:\ios-backup" /mir /purge /tee /log+:c:\Users\%1\AppData\Local\Apple\ROBOCOPY-IOS-DEVICE.log /np

Add these lines to the BATCH-File if you need some help.

@echo off
cls
echo -------------------------------------------------------------
echo Microsoft ROBOCOPY for transferring iOS-Backups to a location
echo .
echo 2012-12-21 by http://iNotes4You.com
echo -------------------------------------------------------------
rem Windows 7 .......................... Some ROBOCOPY Parameters
rem
rem /MIR Mirrors a directory tree
rem /PURGE Deletes destination files/directorys not in source
rem /XD Excludes directories matching specifies names/paths
rem /tee Write status output to console window+log file
rem /log: Write status output to the log file
rem /np no progress (%-Fortschritt nicht anzeigen, loggen)
rem
rem /XD set this parameter for drive mirroring
rem "g:\RECYCLER"
rem "l:\$RECYCLE.BIN"
rem "g:\WindowsImageBackup"
rem "g:\System Volume Information"
rem -------------------------------------------------------------
rem Parameter %1 .......................... your Windows username
rem %2 .......................... the destination drive
rem -------------------------------------------------------------
pause

The BATCH-File uses two parameters %1 and %2.
Either you modify the file by filling in your Windows username and the destination drive or you start the BATCH-File with the command
ROBOCOPY-IOS-DEVICE.bat username destination
e.g. ROBOCOPY-IOS-DEVICE.bat inotes4you d where d is the drive letter for the destination drive.

20121221-144626.jpg

Notes and some stats …

Crash Reporter
While robocopying an iOS-Backup you may see files with extension .crash.
When an application stops functioning properly or crashes on an iOS device, a ‘Crash Report” is created and stored on the device. Crash reports describe the conditions under which the application terminated, in most cases including a complete stack trace for each executing thread, and are typically very useful for debugging issues in the application.

Then each time you sync your iPhone to a Mac or Windows computer, iTunes transfers the crash log content to your local hard drive. You can locate individual crash log files on your computer and delete them in order to free space on your hard drive and device.

Navigate to the
/Logs/CrashReporter/MobileDevice
directory. Delete all files and sync your device via iTunes.

Some stats
The referred devices in the screenshots are an iPhone 4S (64 GB, 13.5 GB used by apps and data) and an iPad 3 (64 GB, 16.7 GB used).
The complete backup of these two devices is 3.95 GB.
The logs\CrashReporter\MobileDevice\… folder contains 4,113 files with 95,1 MB.
The overall number of files of the two device backups is 15,636.





iTunes 11 File Sharing

30 11 2012

iTunes 11 is released.

The Dinosaur-App has got a fresh new design.
I am not a DJ and use iTunes only for backing up my devices and saving files via File Sharing to a local harddrive.

So my rating of iTunes 11 is a bit different from others.
See, why it does not suit my requirements …

20121130-153457.jpg

The good news is …
(quoted from Christian Zibreg on iDownloadBlog.com)

iTunes 11 does not exactly mark a fresh start for the decade-old app, it truly delivers important enhancements while de-cluttering the interface and introducing under-the-hood tweaks.








Follow

Get every new post delivered to your Inbox.

Join 186 other followers

%d bloggers like this: