Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

30
LINES

< > BotCompany Repo | #1011898 // Upload Smart Bot's files to a server (OK)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 10657K of libraries. Click here for Pure Java version (2124L/14K).

1  
!7
2  
3  
sS user = "root", host = "botcompany.de";
4  
sS progID = #1010745;
5  
6  
p {
7  
  //set sshLogin_keepOpen;
8  
  log4j_enableAllDebugMessages();
9  
  File dir = programDir(progID);
10  
  
11  
  new L<S> names;
12  
  for (RemoteResourceInfo info : scpLS(user, host, "JavaX-Data/" + fsI(progID)))
13  
    names.add(info.getName());
14  
    
15  
  int i = 0;
16  
  S bak;
17  
  do {
18  
    bak = "backup" + (++i);
19  
  } while (names.contains(bak));
20  
  
21  
  S backupDir = "JavaX-Data/" + fsI(progID) + "/" + bak;
22  
  scpMkdir(user, host, backupDir);
23  
  
24  
  for (RemoteResourceInfo info : scpLS(user, host, "JavaX-Data/" + fsI(progID)))
25  
    if (info.isRegularFile())
26  
      scpRename(user, host, info.getPath(), backupDir + "/" + info.getName());
27  
      
28  
  for (File f : listFilesOnly(dir))
29  
    scpUploadFile(f, user, host,  "JavaX-Data/" + fsI(progID) + "/" + f.getName());
30  
}

Author comment

Began life as a copy of #1011885

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011898
Snippet name: Upload Smart Bot's files to a server (OK)
Eternal ID of this version: #1011898/8
Text MD5: eae9c3118a0b49b20991a4a21cdcc575
Transpilation MD5: ce9722f42f69c88e8cb61c3b9809d13e
Author: stefan
Category: javax / networking
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-30 11:16:31
Source code size: 840 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 534 / 1207
Version history: 7 change(s)
Referenced in: [show references]