Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to pass url in du -sh command

Avatar

Avatar
Validate 10
Level 3
maheswarik23685
Level 3

Likes

21 likes

Total Posts

32 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 3
maheswarik23685
Level 3

Likes

21 likes

Total Posts

32 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
maheswarik23685
Level 3

13-08-2019

Hi All,

I am creating a workflow to check the total size of root path of a ftp/sftp, if size is greater than 30 MB I need to send an alert. I have the username,password,server details stored in a schema. I have queried that schema and stored all these values in 3 instance variables. Then in another js I created a variable  and used du command as below it gave me size : -53,du: cannot access 'sftp://username:password@ftp.bbb.com/root/':password@ftp.bbb.com/root/': No such file or directory

vars.filepath = "sftp://"+instance.vars.username+":"+instance.vars.password+"@"+instance.vars.server+"/root/";

cmd = "du -sh "+vars.filepath;

vars.res = execCommand(cmd, true);

logInfo("size : "+ vars.res);

Can anyone help on this.How to get the total size of root directory sub-folders need not be considered.

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

976 likes

Total Posts

1,096 posts

Correct Reply

514 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

976 likes

Total Posts

1,096 posts

Correct Reply

514 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

13-08-2019

Hi,

Use `ls -l` to get file sizes from sftp:

NB Security-wise and general coding practices-wise, you shouldn't store login credentials in plaintext or use action-at-a-distance and state when it's not required. Also use keys instead of passwords for auth if possible.

Thanks,

-Jon

Answers (0)