Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 服务器和桌面目标mac os之间的同步文件夹_Objective C_Amazon S3_Synchronization - Fatal编程技术网

Objective c 服务器和桌面目标mac os之间的同步文件夹

Objective c 服务器和桌面目标mac os之间的同步文件夹,objective-c,amazon-s3,synchronization,Objective C,Amazon S3,Synchronization,我有一个要连续同步文件夹的项目: 文件夹\u服务器在服务器上 文件夹\u桌面在我的mac系统上 我想在运行时同步这两个文件夹 以下是我正在执行的步骤: 来自服务器的数据:字典数组,包含:文件名、修改日期、文件大小 本地数据:字典数组,包含:文件名、修改日期、文件大小 比较文件名 若文件不存在,它将被复制到相应的文件夹中 如果文件同时存在于两个文件夹中,则会检查修改日期时间,并修改具有先前日期(较低日期)的文件 逻辑如下: -(void)get_localfile{ } -(void)get

我有一个要连续同步文件夹的项目:

  • 文件夹\u服务器
    在服务器上
  • 文件夹\u桌面
    在我的mac系统上
我想在运行时同步这两个文件夹

以下是我正在执行的步骤:

  • 来自服务器的数据:字典数组,包含:文件名、修改日期、文件大小
  • 本地数据:字典数组,包含:文件名、修改日期、文件大小
  • 比较文件名
  • 若文件不存在,它将被复制到相应的文件夹中

    如果文件同时存在于两个文件夹中,则会检查修改日期时间,并修改具有先前日期(较低日期)的文件

    逻辑如下:

    -(void)get_localfile{
    }
    
    -(void)get_serverfile{
    }
    -(void)Compare_Files{
        //Upload FILES
        for(int i=0;i<[Array_LocalFiles count];i++){
            if(![Array_serverobjects containsObject:[Array_LocalFiles objectAtIndex:i]]){
                //Upload to server
            }else{
    
                NSMutableDictionary *dic=[[NSMutableDictionary alloc] init];
                for(int j=0;j<[arr_Dict_server count];j++){
                    if([[[arr_Dict_server objectAtIndex:j]valueForKey:@"file"] isEqualToString:[Array_LocalFiles objectAtIndex:i]]){
                        NSLog(@"file==server file=>%@",[[arr_Dict_server objectAtIndex:j]valueForKey:@"file"]);
                        NSLog(@"file==local file=>%@",[[arr_Dict_Localfile objectAtIndex:i]valueForKey:@"file"]);
                         dic=[arr_Dict_server objectAtIndex:j];
    
                        NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
                        [dateFormat setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ"];
    
                        NSDate *date_server = [dateFormat dateFromString:[dic valueForKey:@"timestamp"]];
                        NSDate *date_local = [dateFormat dateFromString:[[arr_Dict_Localfile objectAtIndex:i] valueForKey:@"timestamp"]];
    
                        if ( [date_server timeIntervalSinceDate:date_local] == 0) {
                            // //NSLog(@"Dates are equal.no action perform");
    
    
                        }
                        if ( [date_server laterDate:date_local] == date_local ) {
                            //NSLog(@"%@ file upload to server",[Array_LocalFiles objectAtIndex:i]);
    
                        }
                        if ( [date_server laterDate:date_local] == date_server) {
                            //NSLog(@"%@ file dowloaded from server",[dic valueForKey:@"file"]);
    
                        }
    
    
                        break;
                    }
                }
            }
    
    
        }
        //download FILES
        for(int i=0;i<[Array_serverobjects count];i++){
            if(![Array_LocalFiles containsObject:[Array_serverobjects objectAtIndex:i]]){
                //NSLog(@"%@ file dowloaded from server",[Array_serverobjects objectAtIndex:i]);                
            }
        }
    }
    
    -(void)获取本地文件{
    }
    -(void)获取服务器文件{
    }
    -(void)比较\u文件{
    //上传文件
    
    对于(int i=0;iAs)作为替代方案,您可以使用来自的
    aws s3 sync
    命令。@JohnRotenstein我想通过编码来执行此操作。