将AWS S3中的大写文件名更改为小写

时间:2016-06-27 13:29:17

标签: bash shell for-loop amazon-s3

我想请求帮助将AWS S3中的大写文件名更改为小写。

我有两个文件,一个是来自AWS S3存储桶的文件名列表,大写字母是这样的(让我们称之为uppercase.txt):

ABc.txT

aBCd.pHp

AbCdE.jpg

和第二个文件,其中包含将名称转换为小写的列表(lowercase.txt,使用tr'[:upper:]''[:lower:]'轻松完成):

abc.txt

abcd.php

abcde.jpg

我尝试了一堆for循环,我希望重复的命令是'aws s3 mv $ first_list_value $ second_list_value。

试过这个:

for i in `cat uppercase_file.txt`; do aws s3 mv $i `cat lowercase_file.txt`; done

没有骰子:-( AWS S3 API是有限的,并不适用于大多数Linux命令。

Yelp的?

1 个答案:

答案 0 :(得分:1)

这样的事情应该有效:

[Test]
public void TestObserveOn()
{
    Console.WriteLine("Starting on threadId:{0}", Thread.CurrentThread.ManagedThreadId);
    var source = new Subject<object>();
    var exclusiveScheduler = new EventLoopScheduler();
    var are = new AutoResetEvent(false);

    using (source.ObserveOn(exclusiveScheduler).OfType<int>().Subscribe(
        o =>
            {
                Console.WriteLine("Received {1} on threadId:{0}", Thread.CurrentThread.ManagedThreadId, o);
                int sleep = 3000 / o;
                Thread.Sleep(sleep);
                Console.WriteLine("Handled  {1} on threadId: {0}", Thread.CurrentThread.ManagedThreadId, o);
            },
        () =>
            {
                Console.WriteLine("OnCompleted on threadId:{0}", Thread.CurrentThread.ManagedThreadId);
                are.Set();
            }))
    using (source.ObserveOn(exclusiveScheduler).OfType<double>().Subscribe(
                    o =>
                        {
                            Console.WriteLine(
                                "Received {1} on threadId:{0}",
                                Thread.CurrentThread.ManagedThreadId,
                                o);
                            Console.WriteLine(
                                "Handled  {1} on threadId: {0}",
                                Thread.CurrentThread.ManagedThreadId,
                                o);
                        },
                    () =>
                    {
                        Console.WriteLine("OnCompleted on threadId:{0}", Thread.CurrentThread.ManagedThreadId);
                        are.Set();
                    }))
    {
        Console.WriteLine("Subscribed on threadId:{0}", Thread.CurrentThread.ManagedThreadId);

        source.OnNext(1);
        source.OnNext(1.1);
        source.OnNext(2);
        source.OnNext(2.1);
        source.OnNext(3);
        source.OnNext(3.1);
        source.OnCompleted();

        Console.WriteLine("Finished on threadId:{0}", Thread.CurrentThread.ManagedThreadId);

        are.WaitOne();
        are.WaitOne();
    }
}