Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated May 21, 2024

Move files

You can move an existing file to a different folder location in your S3 bucket. The user initiating the move operation must have read and write permission on both the source file and destination file.

import 'package:amplify_flutter/amplify_flutter.dart';
Future<void> movePrivateFile({
required String sourceKey,
required String destinationKey,
}) async {
try {
final result = await Amplify.Storage.move(
source: StorageItemWithAccessLevel(
storageItem: StorageItem(key: sourceKey),
accessLevel: StorageAccessLevel.private,
destination: StorageItemWithAccessLevel(
storageItem: StorageItem(key: destinationKey),
accessLevel: StorageAccessLevel.private,
safePrint('Moved file to: ${result.movedItem.key}');
} on StorageException catch (e) {
safePrint('Something went wrong moving the file: ${e.message}');